plynx.service.worker

Main PLynx worker service and utils

Module Contents

class plynx.service.worker.Worker(worker_config: WorkerConfig, worker_id: Optional[str])[source]

Worker main class.

On the high level Worker distributes Jobs over all available Workers and updates statuses of the Graphs in the database.

Worker performs several roles:
  • Pull graphs in status READY from the database.
  • Create Schedulers for each Graph.
  • Populate the queue of the Jobs.
  • Distribute Jobs accross Workers.
  • Keep track of Job’s statuses.
  • Process CANCEL requests.
  • Update Graph’s statuses.
  • Track worker status and last response.
SDB_STATUS_UPDATE_TIMEOUT :int = 1[source]
WORKER_STATE_UPDATE_TIMEOUT :int = 1[source]
serve_forever(self)[source]

Run the worker.

execute_job(self, executor: BaseExecutor)[source]

Run a single job in the executor

_run_db_status_update(self)[source]

Syncing with the database.

_run_worker_state_update(self)[source]

Syncing with the database.

stop(self)[source]

Stop worker.

plynx.service.worker.run_worker(worker_id: Optional[str] = None)[source]

Run worker daemon. It will run in the same thread.