cowbird.monitoring.monitor
Attributes
Exceptions
Error indicating that a |
Classes
Implementation of the watchdog |
Module Contents
- exception cowbird.monitoring.monitor.MonitorException[source]
Bases:
ExceptionError indicating that a
Monitorcannot be started because of an invalid path or callback.Initialize self. See help(type(self)) for accurate signature.
- class cowbird.monitoring.monitor.Monitor(path: str, recursive: bool, callback: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str)[source]
Bases:
watchdog.events.FileSystemEventHandlerImplementation of the watchdog
FileSystemEventHandlerclass Allows to start/stop directory monitoring and send events toFSMonitorcallback.Initialize the path monitoring and ready to be started.
- Parameters:
path – Path to monitor
recursive – Monitor subdirectory recursively?
callback – Events are sent to this FSMonitor. Can be an object, a class type implementing
FSMonitoror a string containing module and class name. The class type or string is used to instantiate an object using the class methodFSMonitor.get_instance()
- static get_fsmonitor_instance(callback: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str) cowbird.monitoring.fsmonitor.FSMonitor[source]
Return a
FSMonitorinstance from multiple possible forms including theFSMonitortype, theFSMonitorfull qualified class name or a direct instance which is returned as is.
- static get_qualified_class_name(monitor: cowbird.monitoring.fsmonitor.FSMonitor) str[source]
Returns the full qualified class name of the
FSMonitorobject (string of the form module.class_name)
- property callback_instance: cowbird.monitoring.fsmonitor.FSMonitor[source]
- property key: MonitorKey[source]
Return a dict that can be used as a unique key to identify this
Monitorin a BD.
- property is_alive: bool[source]
Returns true if the monitor observer exists and is currently running.
- params() MonitorParameters[source]
Return a dict serializing this object from which a new
Monitorcan be recreated using the init function.
- on_moved(event: watchdog.events.DirMovedEvent | watchdog.events.FileMovedEvent) None[source]
Called when a file or a directory is moved or renamed.
- Parameters:
event – Event representing file/directory movement.
- on_created(event: watchdog.events.DirCreatedEvent | watchdog.events.FileCreatedEvent) None[source]
Called when a file or directory is created.
- Parameters:
event – Event representing file/directory creation.