ovo.core.scheduler.simple_queue_mixin

Module Contents

Classes

SimpleQueueMixin

Class that adds a simple queue-based worker scheduler to a submission system.

TaskQueue

API

class ovo.core.scheduler.simple_queue_mixin.SimpleQueueMixin

Bases: abc.ABC

Class that adds a simple queue-based worker scheduler to a submission system.

has_queue()
_queue_get_address()
queue_put(job_id: str, task: Any)

Put a task into the queue to be processed by a worker.

queue_size(job_id: str = None) int | None

Get number of tasks in the queue (not running yet) or None if queue is not used or job_id is already running (or not found).

Parameters:

job_id – If specified, get the position of the job in the queue: None = running (probably), 0 = next to run, 1 = one job ahead, etc.

Returns:

Number of tasks or None

connect_to_queue(host: str = None, port: int = None)

Connects to the queue server and returns the queue object.

create_queue_server(host: str = None, port: int = None)

Returns queue and function that runs infinitely in the server process, serving the queue to workers.

queue_worker(queue, queue_id)

Function that runs infinitely in the worker process, processing jobs from the queue.

abstractmethod queue_run_task(job_id: str, task: Any)

Execute a single task from the queue synchronously - executed in the worker loop

_queue_get_auth_key()
class ovo.core.scheduler.simple_queue_mixin.TaskQueue

Initialization

put(item)
get()
get_job_ids()