libgs.monitoring.Monitor.monitor

Monitor.monitor(point=None, *args, **kwargs)[source]

Creates a decorator that can be applied to any function to add it to be monitored.

It will do two things:
  1. convert the function to a generator in which the function call is run in an executor, so that any call to the generators next() function will return immeditately and not hold up execution. If the function has not finished the generator will return None. If it has completed, it will return the value as well as a timestamp and any potential exception in the format required for the monitoring loop.
  2. add the function to the Monitor class polling schedule.
Parameters:
  • point – The name of the monitor point. If omitted it will use the function name
  • **kwargs (*args,) –

    Also accepts all the arguments of register_monitor()

Returns:

Decorator