Managers#

Task manager for executing and coordinating multiple tasks with optional parallelization.

class core_mixins.managers.tasks_manager.TasksManager(tasks: List[ITask])[source]#

Bases: object

It manages the execution for the registered tasks

__init__(tasks: List[ITask])[source]#
execute(task_name: str | None = None, parallelize: bool | None = False, processes: int | None = None) List[TaskResult] | TaskResult | None[source]#

Execute all registered tasks. An exception in one task should not stop the execution of the others…

Example of results:

[
    TaskResult(status=TaskStatus.SUCCESS, result=...),
    TaskResult(status=TaskStatus.ERROR, error=...)
]
Parameters:
  • task_name (str) – If defined, only that specific task will be executed.

  • parallelize (bool) – It defines if you want to execute the tasks in parallel.

  • processes (int) – Number of parallel process.

Returns:

The list of the execution results.

Return type:

List[TaskResult]