pyrolab.pyrolabd.PyroLabDaemon

Contents

pyrolab.pyrolabd.PyroLabDaemon#

class PyroLabDaemon[source]#

Bases: object

The PyroLab daemon runs continuously in the background.

The daemon and controls all PyroLab entities through the PyroLabManager singleton. The main purpose of the daemon is to listen for requests and commands, usually sent through the command line interface (CLI).

No script should ever need to import or instantiate the PyroLabDaemon. To preserve its “single instance” nature, the daemon should only be created and run through the CLI (which in turn, runs this module as a script). Limiting daemon manipulation to the CLI guarantees that only one daemon will be running at any given time (courtesy of the Lockfile this script creates and checks).

By default, the daemon will load the user configuration file (manipulatable via the CLI) and write a runtime configuration file (not manipulatable via the CLI). The daemon will not change its configuration unless a call to the reload() method is made, usually by the CLI. Even if the user configuration file is changed, the daemon will not reload unless explictly instructed to do so. It is therefore of the utmost importance that the runtime configuration file be managed solely by the daemon! No touchy!

Note

As a Pyro5 object, no method of the daemon should return any types other than Python builtins, due to serialization issues.

Methods

ps()

List all known processes grouped as nameservers, daemons, and services.

reload()

Reloads the latest configuration file and restarts services that were running.

restart_daemon(name)

Restarts a daemon.

restart_nameserver(name)

Restarts a nameserver.

shutdown()

Shuts down the daemon.

start_daemon(daemon)

Starts a daemon.

start_nameserver(nameserver)

Starts a nameserver.

stop_daemon(daemon)

Stops a daemon.

stop_nameserver(nameserver)

Stops a nameserver.

whoami()

Returns the object ID of the daemon, and it's PID number.