cement.ext.ext_watchdog

Cement watchdog extension module.

class cement.ext.ext_watchdog.WatchdogEventHandler(app, *args, **kw)[source]

Bases: watchdog.events.FileSystemEventHandler

Default event handler used by Cement, that logs all events to the application’s debug log. Additional *args and **kwargs are passed to the parent class.

Parameters:app – The application object
on_any_event(event)[source]

Catch-all event handler.

Parameters:event (FileSystemEvent) – The event object representing the file system event.
class cement.ext.ext_watchdog.WatchdogManager(app, *args, **kw)[source]

Bases: cement.core.meta.MetaMixin

The manager class that is attached to the application object via App.extend().

Usage:

with MyApp() as app:
    app.watchdog.start()
    app.watchdog.stop()
    app.watchdog.join()
add(path, event_handler=None, recursive=True)[source]

Add a directory path and event handler to the observer.

Parameters:

path (str) – A directory path to monitor (str)

Keyword Arguments:
 
  • event_handler (class) – An event handler class used to handle events for path (class)
  • recursive (bool) – Whether to monitor the path recursively
Returns:

True if the path is added, False otherwise.

Return type:

bool

join(*args, **kw)[source]

Join the observer with the parent process. All *args and **kwargs are passed down to the backend observer.

start(*args, **kw)[source]

Start the observer. All *args and **kwargs are passed down to the backend observer.

stop(*args, **kw)[source]

Stop the observer. All *args and **kwargs are passed down to the backend observer.