infozuild.daemon¶
This is the overview of all functions in the daemon
module, which are used
by the zuild program. For information on how to use zuild,
see zuild.
infozuild.daemon provides functions that will periodically update the zuil.
The daemon uses APScheduler to schedule regular updates, by using the functions
found in infozuild.getscript
and infozuild.sendscript
via update_zuil()
.
- The following signals will be handled:
- SIGUSR1: schedule an update job to be executed immediately.
- SIGUSR2: toggle the logging level between INFO and DEBUG.
- SIGINT, SIGTERM, SIGQUIT: Cleanly wait for running jobs to end, and stop the daemon.
-
class
infozuild.daemon.
ZuilManager
(host, controller_address, max_events, print_only=False)[source]¶ The ZuilManager keeps track of what to display on the Zuil, by caching a list of events and responding to update requests.
Using a manager allows us to not lose all events when Koala cannot be reached, but show an informative message and reuse the old events instead. Shutdown messages and rotating MOTDs are also inserted by the manager.
Parameters: - host (str) – The hostname or IP address of the controller.
- controller_address (int) – The controller index, usually 0.
- max_events (int) – The maximum number of events to display. None to show all.
- print_only (bool) – activate debugging and bypass actually updating the zuil, instead only printing the control string to debug.
-
handle_shutdown
()[source]¶ Immediately update the zuil with a new status message indicating the pi is powering off.
-
make_rotation
()[source]¶ Build the rotation that will be sent to the zuil. Exposed for debugging purposes.
-
infozuild.daemon.
quit_handler_cb
(sig, *args)[source]¶ Called when SIGINT, SIGTERM or SIGQUIT is received while in daemon mode. Attempt to shutdown somewhat cleanly by waiting for the currently executing jobs.