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.

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.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

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.