salvus.flow.executors.implementations.slurm
salvus.flow.executors.implementations.slurm salvus flow executors implementations slurm The slurm executor.
Classes
SlurmExecutor
SlurmExecutorclass SlurmExecutor(salvus.flow.executors.base_executor.BaseExecutor):
def __init__(
self,
name: str,
configuration: dict,
db: typing.Any,
verbosity: int = 1,
skip_version_number_check: bool = False,
): ...Base class for a an executor.
An executor is a set of instructions to run a Salvus job or other commands on a type of remote machine.
namestr — Name of the site using the executor.configurationdict — Configuration for the site.dbtyping.Any — Connection to the internal database.verbosityint — Verbosity level.skip_version_number_checkbool — Skip the version number check of the local Python version vs the remote site. Useful for initializing and updating sites.
file_path_type type[pathlib.PurePosixPath | pathlib.PureWindowsPath]
file_path_type type[pathlib.PurePosixPath | pathlib.PureWindowsPath]Returns the type of file paths for the given site.
home_dir pathlib.PurePosixPath | pathlib.PureWindowsPath
home_dir pathlib.PurePosixPath | pathlib.PureWindowsPathThe home directory.
is_initialized bool
is_initialized boolTrue if the site has been synchronized/initialized with the remote site.
os_type OSType
os_type OSTypeReturns the type of the operating system.
Subclasses can overwrite this.
sftp_client paramiko.sftp_client.SFTPClient | LocalSFTPClient
sftp_client paramiko.sftp_client.SFTPClient | LocalSFTPClientGet the sftp client instance.
Will be initialized upon the first access.
ssh_client paramiko.client.SSHClient | LocalSSHClient
ssh_client paramiko.client.SSHClient | LocalSSHClientGet the ssh client instance.
Will be initialized upon the first access.
update_interval_in_seconds float
update_interval_in_seconds floatA site’s actual update interval.
use_cuda_capable_gpus bool
use_cuda_capable_gpus boolTrue if a site uses license tokens.
use_license_tokens float
use_license_tokens floatTrue if a site uses license tokens.
cancel_job()
cancel_job()def cancel_job(self, job_dir: str) -> None: ...Cancels the job.
job_dirstr — The job directory.
execute_command()
execute_command()def execute_command(
self,
command: str,
assert_ok: bool = True,
environment: dict[str, str] | None = None,
) -> tuple[int, list[str], list[str]]: ...Execute the command.
commandstr — The command to run as a string.assert_okbool — Raise if the command does not exist with a code of 0.environmentdict[str, str] | None — Environment variables to be set for this command.
get_job_status()
get_job_status()def get_job_status(self, job_dir: str) -> JobStatus | list[JobStatus]: ...Returns the status of the job or job array to the best knowledge of the remote site.
If the job is a job array, return the status of every job in a list if possible, otherwise just the total status of the whole job.
This is a single method as, in practice, it turns out to be more convenient to implement.
job_dirstr — The job directory.
is_folder_writeable()
is_folder_writeable()def is_folder_writeable(self, path: _RemotePathInputType) -> bool: ...Return True if the user has write permissions in the chosen folder.
path_RemotePathInputType — Path on the remote machine.
launch_many_mpi_jobs()
launch_many_mpi_jobs()def launch_many_mpi_jobs(
self,
job_commands: dict[int, typing.Any],
working_dir: str,
stdout_path: str,
stderr_path: str,
wall_time_in_seconds_per_job: int | None,
license_tokens: list[str] | None = None,
) -> list[JobStatus]: ...Launch many MPI jobs at once.
job_commandsdict[int, typing.Any] — Dictionary of a list of commands, one per list per job.working_dirstr — The remote working directory for the execution.stdout_pathstr — Path to pipe stdout to.stderr_pathstr — Path to pipe stderr to.wall_time_in_seconds_per_jobint | None — Wall-time in seconds per job. Must be given for slurm sites.license_tokenslist[str] | None — If the job array uses license tokens for the license enforcement they are passed here.
launch_mpi_job()
launch_mpi_job()def launch_mpi_job(
self,
commands: list[executor_utils.RemoteCommand],
job_dir: str,
working_dir: str,
stdout_path: str,
stderr_path: str,
wall_time_in_seconds: int | None,
is_debug_job: bool = False,
) -> JobStatus: ...Run an MPI job.
Returns the initial status. Always “pending” for slurm jobs.
commandslist[executor_utils.RemoteCommand] — List of commands. One will be run after the other, but all will be submitted at the same time.job_dirstr — The remote directory where all the job files are stored.working_dirstr — The remote working directory for the execution.stdout_pathstr — Path to pipe stdout to.stderr_pathstr — Path to pipe stderr to.wall_time_in_secondsint | None — Wall-time in seconds. Must be given for slurm sites.is_debug_jobbool — True if this is supposed to be a debug job. Some job management systems have debug or other “fast” queues. Use these special queues if this is set to true.
pretty_print()
pretty_print()def pretty_print(self) -> None: ...Pretty and colorful representation of the site.
remote_exists()
remote_exists()def remote_exists(self, path: _RemotePathInputType) -> bool: ...Check if a remote file or directory exists.
path_RemotePathInputType — Path to check.
remote_get()
remote_get()def remote_get(
self,
remotepath: _RemotePathInputType,
localpath: io.BytesIO | pathlib.Path,
show_progressbar: bool = False,
) -> None: ...Get a remote file.
remotepath_RemotePathInputType — Remote file to get.localpathio.BytesIO | pathlib.Path — Local path to save to Can be a file or a file like object.show_progressbarbool — Show a progressbar or not.
remote_listdir()
remote_listdir()def remote_listdir(self, path: _RemotePathInputType) -> list[str]: ...List the contents of a remote directory.
Just dispatches to the underlying representation.
path_RemotePathInputType — Remote path whose contents to list.
remote_mkdir()
remote_mkdir()def remote_mkdir(
self, path: _RemotePathInputType, mode: int = 511
) -> None: ...Create a directory on the remote or local machine.
path_RemotePathInputType — Directory to create.modeint — Permissions for the new directory.
remote_put()
remote_put()def remote_put(
self,
localpath: io.BytesIO | pathlib.Path,
remotepath: _RemotePathInputType,
show_progressbar: bool = False,
) -> None: ...Copy a local file to a remote path.
localpathio.BytesIO | pathlib.Path — Local file to copy. Can be a file like object.remotepath_RemotePathInputType — Where to copy to.show_progressbarbool — Show a progressbar or not.
remote_rmdir()
remote_rmdir()def remote_rmdir(
self, path: _RemotePathInputType, verbosity: int = 1
) -> None: ...Remotely and recursively delete a remote folder and its contents.
path_RemotePathInputType — Remote path to delete.verbosityint — Verbosity level.
safe_remote_rmdir()
safe_remote_rmdir()def safe_remote_rmdir(
self, path: _RemotePathInputType, allow_failure: bool, verbosity: int = 1
) -> None: ...Convenience wrapper that optionally allows the remote_rmdir() command to fail. Useful for some networked file systems.
path_RemotePathInputType — Remote path to delete.allow_failurebool — Whether to allow failure or not.verbosityint — Verbosity level.