RemoteSlurmJob.submit_script (function)
def submit_script(self, script, files=[], slurm_job_name=None, nprocs=None, walltime='2-00:00:00', mail_type='END,FAIL', mail_user=None, ignore_files=[], wait_for_job_status=False, trial_run=False)
Submit a script to the server in the RemoteSlurmJob.conda_env.
This will copy script (modified with the provided slurm options) and
files to RemoteSlurmJob.remote_directory on the remote server and
submit the script to the slurm scheduler. To check on its status,
see RemoteSlurmJob.job_status.
Additional slurm customization (not included in the keyword arguments listed below) can be included in the beginning of the script.
To check on any expected output files, call RemoteSlurmJob.check_output.
See RemoteSlurmJob.run_script to run a script and wait for it to complete.
Arguments
script(string or list): shell script to run on the remote server, including any necessary installation steps. Note that the script can call any other scripts infiles. If a string, must be the path of a valid file which will be copied to the server. If a list, must be a list of commands (i.e. a newline will be placed between each item in the list and sent as a single script to the server).files(list, optional, default=[]): list of paths to additional files to copy to the server required in order to successfully executescript.slurm_job_name(string, optional, default=None): name of the job within slurm. Prepended toscriptas "#SBATCH -J jobname". Defaults to RemoteSlurmJob.job_name.nprocs(int, optional, default=None): number of processors to run the job. Prepended toscriptas "#SBATCH -n nprocs". If None, will default to thenprocsset when creating the RemoteSlurmJob instance. See RemoteSlurmJob.nprocs.walltime(string, optional, default='2-00:00:00'): maximum walltime to schedule the job. Prepended toscriptas "#SBATCH -t walltime".mail_type(string, optional, default='END,FAIL'): conditions to notify by email tomail_user. Prepended toscriptas "#SBATCH --mail_user=mail_user".mail_user(string, optional, default=None): email to send notifications. If not provided or None, will default to the value in RemoteSlurmServer.mail_user. Prepended toscriptas "#SBATCH --mail_user=mail_user"ignore_files(list, optional, default=[]): list of filenames on the remote server to ignore when calling RemoteSlurmJob.check_outputwait_for_job_status(bool or string or list, optional, default=False): Whether to wait for a specific job_status. If True, will default to 'complete'. See also RemoteSlurmJob.wait_for_job_status.trial_run(bool, optional, default=False): if True, the commands that would be sent to the server are returned but not executed.
Returns
Raises
- ValueError: if a script has already been submitted within this RemoteSlurmJob instance.
- TypeError: if
scriptorfilesare not valid types. - ValueError: if the files referened by
scriptorfilesare not valid.