salvus.flow.sites.task_chain.task_chain
Classes
TaskChain
TaskChainclass TaskChain(builtins.object):
def __init__(
self,
site: salvus.flow.sites.base_site.BaseSite,
tasks: List,
ranks: int,
wall_time_in_seconds: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
data_files_to_upload: Optional[List[Union[pathlib.Path, str]]] = None,
job_name: Optional[str] = None,
initialize_on_site: bool = True,
python_call_prefix: Optional[str] = None,
verbosity: int = 1,
):
...A chain of tasks to be run on a remote site.
Each task can either be a Salvus simulation or a Python function.
sitesalvus.flow.sites.base_site.BaseSite — The site this job is to be run at.tasksList — A list of tasks.ranksint — Number of ranks for the Salvus simulations.wall_time_in_secondsOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Wall time in seconds for the job. Not required for jobs on all sites.data_files_to_uploadOptional[List[Union[pathlib.Path, str]]] — List of optional data files to upload to the task chain directory.job_nameOptional[str] — Name of the job.initialize_on_sitebool — Create the remote folder structure and upload all input files. Set toFalseto recreate aTaskChainobject that has already been initialized once.python_call_prefixOptional[str] — Optional call prefix for the Python calls - useful if they for example have to be spawned with special MPI calls.verbosityint — The verbosity level during the initialization.
full_name str
full_name strThe full name of the task chain including the site name.
job_name str
job_name strThe task chain’s name.
path Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]
path Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]Path of the task chain.
stderr Dict[Union[str, int], str]
stderr Dict[Union[str, int], str]Stderr by task.
stdout Dict[Union[str, int], str]
stdout Dict[Union[str, int], str]Stdout by task.
task_chain_status_file Optional[Dict]
task_chain_status_file Optional[Dict]Get the contents of the task chain status file.
task_status Dict[int, salvus.flow.sites.types.JobStatus]
task_status Dict[int, salvus.flow.sites.types.JobStatus]Get the status of the individual tasks.
timings Dict
timings DictTimings for the individual tasks.
tmp_path Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]
tmp_path Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]Temporary folder.
working_dir Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]
working_dir Union[pathlib.PurePosixPath, pathlib.PureWindowsPath]Working directory of the task chain.
cancel()
cancel()def cancel(self, verbosity: int = 1) -> None:
...Cancel the task chain.
verbosityint — Verbosity level.
delete()
delete()def delete(
self, verbosity: int = 1, allow_directory_deletion_failure: bool = False
) -> None:
...Deletes the data of a task chain if it is not running or pending.
Will delete all remote files and the internal database entry.
verbosityint — Verbosity level.allow_directory_deletion_failurebool — IfTruethis function will still return successfully (but raise a warning) if the deletion of the remote Salvus managed files failed for some reason. This can easily happen on for example networked file systems.
get_diagnosis_string()
get_diagnosis_string()def get_diagnosis_string(self) -> str:
...Get a hopefully useful diagnostic string from the job array.
Useful for trying to figure out why a task chain fails.
launch()
launch()def launch(self, verbosity: int = 1, interactive_tty: bool = False) -> None:
...Launch the job.
verbosityint — Verbosity level.interactive_ttybool — Connect an interactive terminal. Useful for debugging the Python scripts. Only works forlocalsites.
show_pretty_status_widget()
show_pretty_status_widget()def show_pretty_status_widget(self) -> None:
...Show a pretty status widget to quickly inspect what goes happened in a task chain.
tail_stdout()
tail_stdout()def tail_stdout(self) -> None:
...tail -f the stdout of the task chain.
This will launch a remote tail command and it only suitable for
interactive use.
update_status()
update_status()def update_status(
self,
progress_callback: Optional[Callable[[Dict], NoneType]] = None,
force_update: bool = False,
) -> salvus.flow.sites.types.JobStatus:
...Update the status of the task chain by interacting with the remote site.
progress_callbackOptional[Callable[[Dict], NoneType]] — Callback function which will receive some information about the update.force_updatebool — Jobs that are not running and not pending will by default only query the local job database and not check the remote site. In most cases this is correct as the jobs are done with and will not change again. Setting this toTruewill force an update nonetheless. Uses for this are for example if a job update fails for example due to a temporary network problem.
wait()
wait()def wait(
self,
poll_interval_in_seconds: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
timeout_in_seconds: Optional[float] = None,
verbosity: int = 1,
progress_callback: Optional[Callable[[Union[Dict, str]], NoneType]] = None,
) -> salvus.flow.sites.types.JobStatus:
...Wait for the job to finish.
poll_interval_in_secondsOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — If given, the site will be queried with this interval. Defaults to the site’s default.timeout_in_secondsOptional[float] — Time in seconds after which this function will return, independent of the status.verbosityint — The verbosity level.progress_callbackOptional[Callable[[Union[Dict, str]], NoneType]] — Optional progress callback function. Will be called if there are any status updates. Will currently only be called with the Salvus status file contents.