libgs.monitoring.Monitor.add_callback

Monitor.add_callback(callable)[source]

Add a callable to be invoked every time a value is polled. Multiple callbacks can be added.

Note

The callback will be executed in the same sub-thread that does the polling

The prototype of the callable should be:

some_function(point_name, tstamp, exc, ret)

where:

  • point_name is the name of the monitor point that has been polled
  • tstamp is the unix timestamp at which the monitor function returned a value (obtained wiht time.time()),
  • exc is None if no exception happened, otherwise it is set to the exception that occurred.
  • ret are the return values. Will always be an Alert object.
Parameters:callable – The callable