Executor component manager

This module provides an abstract component manager for SKA Tango base devices.

class ska_tango_base.executor.executor_component_manager.TaskExecutorComponentManager[source]

Bases: BaseComponentManager

A component manager with support for asynchronous tasking.

__init__(*args: Any, max_queue_size: int = 32, **kwargs: Any) None[source]

Initialise a new TaskExecutorComponentManager instance.

Parameters:
  • args – Additional positional arguments.

  • max_queue_size – Optional maximum size of the tasks input queue (minimum 1).

  • kwargs – Additional keyword arguments.

cleanup() None[source]

Shutdown the task executor.

property max_executing_tasks: int

Get the maximum number of simultaneously executing tasks.

Returns:

The maximum number of simultaneously executing tasks.

property max_queued_tasks: int

Get the task queue size.

Returns:

The task queue size

submit_task(func: Any, args: Any | None = None, kwargs: Any | None = None, is_cmd_allowed: Callable[[], bool] | None = None, task_callback: TaskCallbackType | None = None) tuple[TaskStatus, str][source]

Submit a task to the task executor.

Parameters:
  • func – function/bound method to be run

  • args – positional arguments to the function

  • kwargs – keyword arguments to the function

  • is_cmd_allowed – sanity check for func

  • task_callback – callback to be called whenever the status of the task changes.

Returns:

tuple of TaskStatus & message

abort_tasks(task_callback: TaskCallbackType | None = None) tuple[TaskStatus, str][source]

Tell the task executor to abort all tasks.

Parameters:

task_callback – callback to be called whenever the status of this abort task changes.

Returns:

tuple of TaskStatus & message