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.
generate_status()[source]

Determine what message will be shown as status if no error.

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.

refresh_zuil()[source]

Create a new Rotation, populate it with the earlier retrieved events, and send it to the controller to be displayed.

update_activities()[source]

Attempt to update the cache of events, keep the old events in case of an error, and refresh the display with the possibly new content.

infozuild.daemon.main()[source]

zuild entry point.

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.

infozuild.daemon.toggle_loglevel_cb(*args)[source]

Called on SIGUSR2, toggles the loglevel between DEBUG and WARNING.

infozuild.daemon.update_now_cb(*args)[source]

Called on SIGUSR1, add a ‘update-zuil’-job scheduled to execute immediately.