![]() |
Belle II Software development
|
Public Member Functions | |
| __init__ (self, *, backend_args=None) | |
| can_submit (self, *args, **kwargs) | |
| submit (self, job, check_can_submit=True, jobs_per_check=100) | |
| get_batch_submit_script_path (self, job) | |
| get_submit_script_path (self, job) | |
Public Attributes | |
| int | global_job_limit = self.default_global_job_limit |
| The active job limit. | |
| int | sleep_between_submission_checks = self.default_sleep_between_submission_checks |
| Seconds we wait before checking if we can submit a list of jobs. | |
| dict | backend_args = {**self.default_backend_args, **backend_args} |
| The backend args that will be applied to jobs unless the job specifies them itself. | |
Static Public Attributes | |
| list | submission_cmds = [] |
| Shell command to submit a script, should be implemented in the derived class. | |
| int | default_global_job_limit = 1000 |
| Default global limit on the total number of submitted/running jobs that the user can have. | |
| int | default_sleep_between_submission_checks = 30 |
| Default time betweeon re-checking if the active jobs is below the global job limit. | |
| str | submit_script = "submit.sh" |
| Default submission script name. | |
| str | exit_code_file = "__BACKEND_CMD_EXIT_STATUS__" |
| Default exit code file name. | |
| dict | default_backend_args = {} |
| Default backend_args. | |
Protected Member Functions | |
| _add_batch_directives (self, job, file) | |
| _make_submit_file (self, job, submit_file_path) | |
| _submit_to_batch (cls, cmd) | |
| _create_job_result (cls, job, batch_output) | |
| _create_cmd (self, job) | |
| _add_wrapper_script_setup (self, job, batch_file) | |
| _add_wrapper_script_teardown (self, job, batch_file) | |
| _create_parent_job_result (cls, parent) | |
Static Protected Member Functions | |
| _add_setup (job, batch_file) | |
Abstract Base backend for submitting to a local batch system. Batch system specific commands should be implemented in a derived class. Do not use this class directly!
Definition at line 1137 of file backends.py.
| __init__ | ( | self, | |
| * | , | ||
| backend_args = None ) |
Init method for Batch Backend. Does some basic default setup.
Definition at line 1160 of file backends.py.
|
protected |
Should be implemented in a derived class to write a batch submission script to the job.working_dir. You should think about where the stdout/err should go, and set the queue name.
Reimplemented in HTCondor, LSF, and PBS.
Definition at line 1172 of file backends.py.
|
staticprotectedinherited |
Adds setup lines to the shell script file.
Definition at line 807 of file backends.py.
|
protectedinherited |
Adds lines to the submitted script that help with job monitoring/setup. Mostly here so that we can insert `trap` statements for Ctrl-C situations.
Definition at line 814 of file backends.py.
|
protectedinherited |
Adds lines to the submitted script that help with job monitoring/teardown. Mostly here so that we can insert an exit code of the job cmd being written out to a file. Which means that we can know if the command was successful or not even if the backend server/monitoring database purges the data about our job i.e. If PBS removes job information too quickly we may never know if a job succeeded or failed without some kind of exit file.
Definition at line 839 of file backends.py.
|
protected |
Reimplemented in HTCondor, LSF, and PBS.
Definition at line 1352 of file backends.py.
|
protected |
Reimplemented in HTCondor, LSF, and PBS.
Definition at line 1347 of file backends.py.
|
protectedinherited |
We want to be able to call `ready()` on the top level `Job.result`. So this method needs to exist so that a Job.result object actually exists. It will be mostly empty and simply updates subjob statuses and allows the use of ready().
Reimplemented in HTCondor, Local, LSF, and PBS.
Definition at line 852 of file backends.py.
|
protected |
Useful for the HTCondor backend where a submit is needed instead of batch directives pasted directly into the submission script. It should be overwritten if needed.
Reimplemented in HTCondor.
Definition at line 1180 of file backends.py.
|
protected |
Do the actual batch submission command and collect the output to find out the job id for later monitoring.
Reimplemented in HTCondor, LSF, and PBS.
Definition at line 1189 of file backends.py.
| can_submit | ( | self, | |
| * | args, | ||
| ** | kwargs ) |
Should be implemented in a derived class to check that submitting the next job(s) shouldn't fail.
This is initially meant to make sure that we don't go over the global limits of jobs (submitted + running).
Returns:
bool: If the job submission can continue based on the current situation.
Reimplemented in HTCondor, LSF, and PBS.
Definition at line 1194 of file backends.py.
| get_batch_submit_script_path | ( | self, | |
| job ) |
Construct the Path object of the script file that we will submit using the batch command. For most batch backends this is the same script as the bash script we submit. But for some they require a separate submission file that describes the job. To implement that you can implement this function in the Backend class.
Reimplemented in HTCondor.
Definition at line 1336 of file backends.py.
|
inherited |
Construct the Path object of the bash script file that we will submit. It will contain the actual job command, wrapper commands, setup commands, and any batch directives
Definition at line 860 of file backends.py.
| submit | ( | self, | |
| job, | |||
| check_can_submit = True, | |||
| jobs_per_check = 100 ) |
Reimplemented from Backend.
Definition at line 1205 of file backends.py.
|
inherited |
The backend args that will be applied to jobs unless the job specifies them itself.
Definition at line 797 of file backends.py.
|
staticinherited |
Default backend_args.
Definition at line 789 of file backends.py.
|
static |
Default global limit on the total number of submitted/running jobs that the user can have.
This limit will not affect the total number of jobs that are eventually submitted. But the jobs won't actually be submitted until this limit can be respected i.e. until the number of total jobs in the Batch system goes down. Since we actually submit in chunks of N jobs, before checking this limit value again, this value needs to be a little lower than the real batch system limit. Otherwise you could accidentally go over during the N job submission if other processes are checking and submitting concurrently. This is quite common for the first submission of jobs from parallel calibrations.
Note that if there are other jobs already submitted for your account, then these will count towards this limit.
Definition at line 1156 of file backends.py.
|
static |
Default time betweeon re-checking if the active jobs is below the global job limit.
Definition at line 1158 of file backends.py.
|
staticinherited |
Default exit code file name.
Definition at line 787 of file backends.py.
| int global_job_limit = self.default_global_job_limit |
The active job limit.
This is 'global' because we want to prevent us accidentally submitting too many jobs from all current and previous submission scripts.
Definition at line 1167 of file backends.py.
| int sleep_between_submission_checks = self.default_sleep_between_submission_checks |
Seconds we wait before checking if we can submit a list of jobs.
Only relevant once we hit the global limit of active jobs, which is a lot usually.
Definition at line 1170 of file backends.py.
|
static |
Shell command to submit a script, should be implemented in the derived class.
Definition at line 1143 of file backends.py.
|
staticinherited |
Default submission script name.
Definition at line 785 of file backends.py.