cowbird.monitoring.monitoring

Module Contents

Classes

Monitoring

Class handling file system monitoring and registering listeners.

Attributes

LOGGER

cowbird.monitoring.monitoring.LOGGER[source]
class cowbird.monitoring.monitoring.Monitoring(config=None)[source]

Class handling file system monitoring and registering listeners.

Todo

At some point we will need a consistency function that goes through all monitored folder and make sure that monitoring services are up to date.

Initialize the monitoring instance from configured application settings.

@param config: AnySettingsContainer object from which the db can be retrieved.

The default value of None is only there to disable pylint E1120. The singleton instance must be initialized with a proper config and after that the init function should not be hit.

start(self)[source]

Load existing monitors and start the monitoring.

register(self: str, path: bool, recursive: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str], cb_monitor)cowbird.monitoring.monitor.Monitor[source]

Register a monitor for a specific path and start it. If a monitor already exists for the specific path/cb_monitor combination it is directly returned. If this monitor was not recursively monitoring its path and the recursive flag is now true, this one take precedence and the monitor is updated accordingly. If the recursive flag was true and now it is false it has no effect.

@param path: Path to monitor @param recursive: Monitor subdirectory recursively? @param cb_monitor: FSMonitor for which an instance is created and events are sent

Can be an object, a class type implementing FSMonitor or a string containing module and class name.

@return The monitor registered or already existing for the specific path/cb_monitor combination.

unregister(self: str, path: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str], cb_monitor)bool[source]

Stop a monitor and unregister it.

@param path: Path used by the monitor @param cb_monitor: FSMonitor object to remove

Can be an object, a class type implementing FSMonitor or a string containing module and class name.

@return: True if the monitor is found and successfully stopped, False otherwise