Worker client: connects to debusine server.
Registration (needed only once per worker): If the worker doesn’t have a token: it will generate it and register with the server (HTTP POST to
The client will use this token to connect to the server (WebSocket to
The worker is executed and chooses
~/.config/debusine/worker(if it exists) or
/etc/debusine/worker. It reads the file
config.inifrom the directory and if it already exists the file
If there isn’t a token the worker generates one (using
secrets.token_hex()) and registers it to the Debusine server via HTTP POST to /api/1.0/worker/register sending the generated token and the worker’s FQDN. The token is saved to the
tokenfile in the chosen config directory.
The server will create a new Token and Worker in the DB via the models. They wouldn’t be used until manual validation.
The client can then connect using WebSockets to
/ws/1.0/worker/connectto wait for commands to execute.
Worker(*, log_file: Optional[str] = None, log_level=None, config=None)¶
Worker class: waits for commands from the debusine server.
__init__(*, log_file: Optional[str] = None, log_level=None, config=None)¶
log_file – log file to where the logs are saved. If None uses settings from config.ini or default’s Python (stderr).
log_level – minimum level of the logs being saved. If None uses settings from config.ini or DEFAULT_LOG_LEVEL.
config – ConfigHandler to use (or creates a default one)
Close the AioHTTP session.
Connect (registering if needed) to the debusine server.
Uses the URL for debusine server from the configuration file.
Log a forced exit.
Run the worker.