gws.server.monitor¶
Server monitor, which watches files and runs periodic tasks.
Source code: gws.server.monitor
Module Contents¶
- gws.server.monitor.DEFAULT_FREQUENCY = 30¶
- class gws.server.monitor.Object¶
Bases:
gws.ServerMonitorServer monitor.
- watcher: gws.lib.watcher.Watcher¶
File watcher, created on start unless
disableWatchis set.
- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- register_periodic_task(obj, frequency=0)¶
Register an object as a periodic task handler.
- Parameters:
obj – A node with a
periodic_taskmethod.frequency – Interval between runs in seconds, the monitor default if 0.
- Raises:
gws.Error – If the object has no
periodic_taskmethod.
- schedule_reload(with_reconfigure=False)¶
Schedule a reload of the web and spool backends.
The reload is performed by the monitor on its next tick.
- Parameters:
with_reconfigure – Reconfigure the server before reloading.
- start()¶
Start watching files and register the timer that drives the monitor.
Must be called in a uWSGI process.
- watch_directory(dirname, pattern, recursive=False)¶
Add a directory to watch.
- Parameters:
path – Directory path.
pattern – Regex pattern for file names to watch.
recursive – Also watch subdirectories.
- watch_file(path)¶
Add a file to watch.
- Parameters:
path – File path.