salvus.flow.executors.task_chain.task_chain_controller
salvus.flow.executors.task_chain.task_chain_controller salvus flow executors task_chain task_chain_controller The task chain controller implementation.
Classes
StdOutErr
StdOutErrclass StdOutErr(builtins.object):
def __init__(
self, stdout: dict | None, stderr: dict | None, timings: dict | None
) -> None: ...The stdout and stderr of a single task chain.
Both output could be None in case they don’t exist.
stdoutdict | None — The stdout.stderrdict | None — The stderr.timingsdict | None — The timings for the given task chain.
get_diagnosis_string()
get_diagnosis_string()def get_diagnosis_string(self) -> str: ...Get a hopefully useful diagnostic string from the task chain output.
TaskChainController
TaskChainControllerclass TaskChainController(builtins.object):
def __init__(
self,
task_chain_tasks: dict[str, list],
sites: dict[str, TaskChainSiteConfig],
task_chain_runner_context: typing.Callable | None = None,
): ...The TaskChainController is responsible for distributing TaskChainRunners across resources.
task_chain_tasksdict[str, list] — A dictionary mapping an arbitrary job key (name) to a list of tasks, e.g. tasks that happen within one task chain.sitesdict[str, TaskChainSiteConfig] — A dictionary of identifier + site config for sites to run the tasks on. The identifier does not have to be the site name.task_chain_runner_contexttyping.Callable | None — A optional function returning a context manager that will be used in each TaskChainRunner prior to running the actual task chains.
check_status_of_task_chain_runners()
check_status_of_task_chain_runners()def check_status_of_task_chain_runners(
self, raise_on_error: bool = True
) -> None: ...Check the status of the individual task chain runners. Will return nothing if all finished, otherwise an exception with more information will be thrown.
raise_on_errorbool — If True, an exception will be raised if one of the child local task chain runner fail (not the individual task chains). If False, a warning will be logged.
delete_remote_files()
delete_remote_files()def delete_remote_files(self, verbosity: int = 1) -> None: ...Delete all remote files for the task chain controller - in most cases, nothing should remain after this method has been called.
verbosityint — The verbosity.
get_site_and_remote_path_for_task_chain()
get_site_and_remote_path_for_task_chain()def get_site_and_remote_path_for_task_chain(
self, identifier: str
) -> tuple[BaseExecutor, _RemotePathType]: ...Get the site + remote path for a given task chain.
identifierstr — Identifier of the task chain to get.
get_status_for_all_task_chains()
get_status_for_all_task_chains()def get_status_for_all_task_chains(self) -> dict[str, JobStatus | None]: ...Get a dictionary with the status of every individual task chain.
This is most useful after the controller finished running.
The status for a task chain might be None, if it has not been set.
get_stdouterr_for_task_chain()
get_stdouterr_for_task_chain()def get_stdouterr_for_task_chain(self, identifier: str) -> StdOutErr: ...Get the stdout and stderr for a given task chain.
identifierstr — Identifier of the task chain to get.
launch()
launch()def launch(self) -> None: ...Launch the remote task chain runners.
run()
run()def run(self, assert_no_failed_runners: bool = True) -> None: ...Run the task chains across the individual sites by dispatching to one task chain runner per site.
The task chain runner will take care of the parallelization per site.
assert_no_failed_runnersbool — If True, an exception will be raised if one of the child local task chain runner fails (not the individual task chains). If False, a warning will be logged. This is useful for error resilient workflows but will require error handling elsewhere.
update_status()
update_status()def update_status(self) -> dict[str, JobStatus]: ...Update the status of all task chain runners.
wait()
wait()def wait(self) -> None: ...Wait until all task chains runners have finished or failed.