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 /api/1.0/worker/register)

  • The client will use this token to connect to the server (WebSocket to /ws/1.0/worker/connect)


  1. The worker is executed and chooses ~/.config/debusine/worker (if it exists) or /etc/debusine/worker. It reads the file config.ini from the directory and if it already exists the file token.

  2. 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 token file in the chosen config directory.

  3. The server will create a new Token and Worker in the DB via the models. They wouldn’t be used until manual validation.

  4. The client can then connect using WebSockets to /ws/1.0/worker/connect to wait for commands to execute.

Objects documentation

class debusine.worker.Worker(*, log_file: Optional[str] = None, log_level=None, config=None)[source]

Worker class: waits for commands from the debusine server.

__init__(*, log_file: Optional[str] = None, log_level=None, config=None)[source]

Initialize Worker.

  • log_file – log file to where the logs are saved

  • log_level – minimum level of the logs being saved

  • config – ConfigHandler to use (or creates a default one)

async close()[source]

Close the AioHTTP session

async connect()[source]

Connect (registering if needed) to the debusine server.

Uses the URL for debusine server from the configuration file.

async main()[source]

Run the worker