orangeqs.juice.task_manager.tasks#

Task definitions for the Task Manager service.

Module Contents#

Classes#

GetEventTopicList

Get the list of pub/sub topics seen by the task manager.

ScheduleTask

Ask the task manager to schedule a ScheduledTask wrapping an inner Task.

CancelScheduledTask

Ask the task manager to cancel a ScheduledTask.

ReserveServiceSlot

Reserve the serial slot of a service for a proxy kernel cell.

RenewServiceSlot

Tell the Task Manager that the proxy kernel of a held slot still runs.

ReleaseServiceSlot

Release a slot that ReserveServiceSlot reserved.

GetScheduledTask

Query a snapshot of a single ScheduledTask by id.

GetScheduledTasks

Query a snapshot of every ScheduledTask the task manager holds.

ScheduledTaskSnapshot

A read-only view of a ScheduledTask.

API#

class orangeqs.juice.task_manager.tasks.GetEventTopicList(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Get the list of pub/sub topics seen by the task manager.

Returns a mapping of each unique topic to the timestamp it was last seen.

parallel: ClassVar[bool]#

True

class orangeqs.juice.task_manager.tasks.ScheduleTask(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Ask the task manager to schedule a ScheduledTask wrapping an inner Task.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

scheduled_task_target: str#

None

The service the scheduled Task will run on.

task_type: str#

None

The inner Task’s type name.

task_metadata: dict[str, Any]#

None

The inner Task’s metadata (parallel/display_name/show_in_dashboard).

task_payload: dict[str, Any]#

None

The inner Task’s payload fields.

task_display_name: str#

None

Human-readable name of the inner Task.

run_at: datetime.datetime | None#

None

Earliest time the ScheduledTask should fire; None means as soon as eligible.

to_scheduled_task(scheduled_task_id: str, submitted_at: datetime.datetime | None = None) → orangeqs.juice.task_manager._scheduler.ScheduledTask#

Build the :class:ScheduledTask this request describes.

class orangeqs.juice.task_manager.tasks.CancelScheduledTask(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Ask the task manager to cancel a ScheduledTask.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

scheduled_task_id: str#

None

The id of the ScheduledTask to cancel.

class orangeqs.juice.task_manager.tasks.ReserveServiceSlot(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Reserve the serial slot of a service for a proxy kernel cell.

The task completes when the slot is held, or when the reservation is released before it got the slot. The result is True if the slot is held. Release the slot with ReleaseServiceSlot.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

reservation_id: str#

None

Unique id of the reservation.

service: str#

None

The service to reserve.

submitted_by: str | None#

None

Identity of the user that reserves the service, for example user-alice.

class orangeqs.juice.task_manager.tasks.RenewServiceSlot(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Tell the Task Manager that the proxy kernel of a held slot still runs.

The proxy kernel sends this at regular intervals while a cell runs, and when the next cell runs with the same reservation (for example with Run All). The watchdog of the Task Manager does not release a slot while its proxy renews it. The result is False if the slot is not held.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

reservation_id: str#

None

The id of the reservation.

cell_count: int | None#

None

Number of cells that ran with the reservation, for the name on the dashboard.

class orangeqs.juice.task_manager.tasks.ReleaseServiceSlot(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Release a slot that ReserveServiceSlot reserved.

If the reservation still waits for the slot, this cancels it. The result is False if the reservation is not known.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

reservation_id: str#

None

The id of the reservation to release.

class orangeqs.juice.task_manager.tasks.GetScheduledTask(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Query a snapshot of a single ScheduledTask by id.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

scheduled_task_id: str#

None

The id of the ScheduledTask to snapshot.

class orangeqs.juice.task_manager.tasks.GetScheduledTasks(/, **data: Any)#

Bases: orangeqs.juice.task.Task

Query a snapshot of every ScheduledTask the task manager holds.

parallel: ClassVar[bool]#

True

show_in_dashboard: ClassVar[bool]#

False

class orangeqs.juice.task_manager.tasks.ScheduledTaskSnapshot(/, **data: Any)#

Bases: pydantic.BaseModel

A read-only view of a ScheduledTask.

scheduled_task_id: str#

None

task_id: str | None#

None

The dispatched occurrence’s task id, matching its TaskEvent.task_id.

target: str#

None

task_type: str#

None

display_name: str#

None

status: str#

None

run_at: datetime.datetime | None#

None

submitted_at: datetime.datetime#

None

submitted_by: str | None#

None

Identity of the user or service that submitted the ScheduledTask, if known.

result: dict[str, Any] | None#

None

eligible: bool#

False

Queued with its run_at

overdue: bool#

False

If the target service is busy and the ScheduledTask is scheduled to execute.

classmethod of(scheduled_task: orangeqs.juice.task_manager._scheduler.ScheduledTask, now: datetime.datetime | None = None, *, slot_busy: bool = False) → orangeqs.juice.task_manager.tasks.ScheduledTaskSnapshot#

Build a snapshot of scheduled_task as seen at now.