alab_management.task_manager.task_manager module#

TaskLauncher is the core module of the system, which actually executes the tasks.

class TaskManager[source]#

Bases: object

TaskManager will.

  1. find all the ready tasks and submit them,

  2. handle all the resource requests

check_number_of_running_tasks()[source]#

Check the number of running tasks.

Return type:

int

clean_up_tasks_from_previous_runs()[source]#

Arm cleanup for leftover RUNNING / REQUESTING_RESOURCES tasks without blocking.

INITIATED tasks are requeued to READY immediately. For each dangling task a dashboard restart-cleanup prompt is posted; device/sample locks stay held until the operator OKs that prompt (handled by the dashboard completer). Dramatiq can start consuming other work right away.

This typically occurs if workers were exited (SIGTERM / crash) while tasks were still RUNNING or REQUESTING_RESOURCES.

handle_tasks_to_be_canceled()[source]#

Check if there are any tasks needs to be stopped.

pause_new_task_launching()[source]#

Context manager to pause new task launching.

run()[source]#

Start the loop.

submit_ready_tasks()[source]#

Checking if there are any tasks that are ready to be submitted. (STATUS = READY) If so, submit them to task actor (dramatiq worker).