Belle II Software development
PBS Class Reference
Inheritance diagram for PBS:
Batch Backend

Classes

class  PBSResult
 

Public Member Functions

 __init__ (self, *, backend_args=None)
 
 can_submit (self, njobs=1)
 
 qstat (cls, username="", job_ids=None)
 
 submit (self, job, check_can_submit=True, jobs_per_check=100)
 
 get_batch_submit_script_path (self, job)
 
 get_submit_script_path (self, job)
 

Static Public Member Functions

 create_job_record_from_element (job_elem)
 

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

str cmd_wkdir = "#PBS -d"
 Working directory directive.
 
str cmd_stdout = "#PBS -o"
 stdout file directive
 
str cmd_stderr = "#PBS -e"
 stderr file directive
 
str cmd_queue = "#PBS -q"
 Queue directive.
 
str cmd_name = "#PBS -N"
 Job name directive.
 
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, batch_file)
 
 _create_job_result (cls, job, batch_output)
 
 _create_cmd (self, script_path)
 
 _submit_to_batch (cls, cmd)
 
 _create_parent_job_result (cls, parent)
 
 _make_submit_file (self, job, submit_file_path)
 
 _ (self, job, check_can_submit=True, jobs_per_check=100)
 
 _ (self, job, check_can_submit=True, jobs_per_check=100)
 
 _ (self, jobs, check_can_submit=True, jobs_per_check=100)
 
 _add_wrapper_script_setup (self, job, batch_file)
 
 _add_wrapper_script_teardown (self, job, batch_file)
 

Static Protected Member Functions

 _add_setup (job, batch_file)
 

Detailed Description

Backend for submitting calibration processes to a qsub batch system.

Definition at line 1352 of file backends.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* ,
backend_args = None )
 

Definition at line 1373 of file backends.py.

1373 def __init__(self, *, backend_args=None):
1374 """
1375 """
1376 super().__init__(backend_args=backend_args)
1377

Member Function Documentation

◆ _() [1/3]

_ ( self,
job,
check_can_submit = True,
jobs_per_check = 100 )
protectedinherited
Submit method of Batch backend for a `SubJob`. Should take `SubJob` object, create needed directories,
create batch script, and send it off with the batch submission command.
It should apply the correct options (default and user requested).

Should set a Result object as an attribute of the job.

Definition at line 1211 of file backends.py.

1211 def _(self, job, check_can_submit=True, jobs_per_check=100):
1212 """
1213 Submit method of Batch backend for a `SubJob`. Should take `SubJob` object, create needed directories,
1214 create batch script, and send it off with the batch submission command.
1215 It should apply the correct options (default and user requested).
1216
1217 Should set a Result object as an attribute of the job.
1218 """
1219 # Make sure the output directory of the job is created, commented out due to permission issues
1220 # job.output_dir.mkdir(parents=True, exist_ok=True)
1221 # Make sure the working directory of the job is created
1222 job.working_dir.mkdir(parents=True, exist_ok=True)
1223 job.copy_input_sandbox_files_to_working_dir()
1224 job.dump_input_data()
1225 # Make submission file if needed
1226 batch_submit_script_path = self.get_batch_submit_script_path(job)
1227 self._make_submit_file(job, batch_submit_script_path)
1228 # Get the bash file we will actually run, might be the same file
1229 script_path = self.get_submit_script_path(job)
1230 # Construct the batch submission script (with directives if that is supported)
1231 with open(script_path, mode="w") as batch_file:
1232 self._add_batch_directives(job, batch_file)
1233 self._add_wrapper_script_setup(job, batch_file)
1234 self._add_setup(job, batch_file)
1235 print(job.full_command, file=batch_file)
1236 self._add_wrapper_script_teardown(job, batch_file)
1237 os.chmod(script_path, 0o755)
1238 B2INFO(f"Submitting {job}")
1239 # Do the actual batch submission
1240 cmd = self._create_cmd(batch_submit_script_path)
1241 output = self._submit_to_batch(cmd)
1242 self._create_job_result(job, output)
1243 job.status = "submitted"
1244 B2INFO(f"{job} submitted")
1245

◆ _() [2/3]

_ ( self,
job,
check_can_submit = True,
jobs_per_check = 100 )
protectedinherited
Submit method of Batch backend. Should take job object, create needed directories, create batch script,
and send it off with the batch submission command, applying the correct options (default and user requested.)

Should set a Result object as an attribute of the job.

Definition at line 1247 of file backends.py.

1247 def _(self, job, check_can_submit=True, jobs_per_check=100):
1248 """
1249 Submit method of Batch backend. Should take job object, create needed directories, create batch script,
1250 and send it off with the batch submission command, applying the correct options (default and user requested.)
1251
1252 Should set a Result object as an attribute of the job.
1253 """
1254 # Make sure the output directory of the job is created, commented out due to permissions issue
1255 # job.output_dir.mkdir(parents=True, exist_ok=True)
1256 # Make sure the working directory of the job is created
1257 job.working_dir.mkdir(parents=True, exist_ok=True)
1258 # Check if we have any valid input files
1259 job.check_input_data_files()
1260 # Add any required backend args that are missing (I'm a bit hesitant to actually merge with job.backend_args)
1261 # just in case you want to resubmit the same job with different backend settings later.
1262 # job_backend_args = {**self.backend_args, **job.backend_args}
1263
1264 # If there's no splitter then we just submit the Job with no SubJobs
1265 if not job.splitter:
1266 # Get all of the requested files for the input sandbox and copy them to the working directory
1267 job.copy_input_sandbox_files_to_working_dir()
1268 job.dump_input_data()
1269 # Make submission file if needed
1270 batch_submit_script_path = self.get_batch_submit_script_path(job)
1271 self._make_submit_file(job, batch_submit_script_path)
1272 # Get the bash file we will actually run
1273 script_path = self.get_submit_script_path(job)
1274 # Construct the batch submission script (with directives if that is supported)
1275 with open(script_path, mode="w") as batch_file:
1276 self._add_batch_directives(job, batch_file)
1277 self._add_wrapper_script_setup(job, batch_file)
1278 self._add_setup(job, batch_file)
1279 print(job.full_command, file=batch_file)
1280 self._add_wrapper_script_teardown(job, batch_file)
1281 os.chmod(script_path, 0o755)
1282 B2INFO(f"Submitting {job}")
1283 # Do the actual batch submission
1284 cmd = self._create_cmd(batch_submit_script_path)
1285 output = self._submit_to_batch(cmd)
1286 self._create_job_result(job, output)
1287 job.status = "submitted"
1288 B2INFO(f"{job} submitted")
1289 else:
1290 # Create subjobs according to the splitter's logic
1291 job.splitter.create_subjobs(job)
1292 # Submit the subjobs
1293 self.submit(list(job.subjobs.values()))
1294 # After submitting subjobs, make a Job.result for the parent Job object, used to call ready() on
1295 self._create_parent_job_result(job)
1296

◆ _() [3/3]

_ ( self,
jobs,
check_can_submit = True,
jobs_per_check = 100 )
protectedinherited
Submit method of Batch Backend that takes a list of jobs instead of just one and submits each one.

Definition at line 1298 of file backends.py.

1298 def _(self, jobs, check_can_submit=True, jobs_per_check=100):
1299 """
1300 Submit method of Batch Backend that takes a list of jobs instead of just one and submits each one.
1301 """
1302 B2INFO(f"Submitting a list of {len(jobs)} jobs to a Batch backend")
1303 # Technically this could be a list of Jobs or SubJobs. And if it is a list of Jobs then it might not
1304 # be necessary to check if we can submit right now. We could do it later during the submission of the
1305 # SubJob list. However in the interest of simpler code we just do the check here, and re-check again
1306 # if a SubJob list comes through this function. Slightly inefficient, but much simpler logic.
1307
1308 # The first thing to do is make sure that we are iterating through the jobs list in chunks that are
1309 # equal to or smaller than the global limit. Otherwise nothing will ever submit.
1310
1311 if jobs_per_check > self.global_job_limit:
1312 B2INFO(f"jobs_per_check (={jobs_per_check}) but this is higher than the global job "
1313 f"limit for this backend (={self.global_job_limit}). Will instead use the "
1314 " value of the global job limit.")
1315 jobs_per_check = self.global_job_limit
1316
1317 # We group the jobs list into chunks of length jobs_per_check
1318 for jobs_to_submit in grouper(jobs_per_check, jobs):
1319 # Wait until we are allowed to submit
1320 while not self.can_submit(njobs=len(jobs_to_submit)):
1321 B2INFO("Too many jobs are currently in the batch system globally. Waiting until submission can continue...")
1322 time.sleep(self.sleep_between_submission_checks)
1323 else:
1324 # We loop here since we have already checked if the number of jobs is low enough, we don't want to hit this
1325 # function again unless one of the jobs has subjobs.
1326 B2INFO(f"Submitting the next {len(jobs_to_submit)} jobs...")
1327 for job in jobs_to_submit:
1328 self.submit(job, check_can_submit, jobs_per_check)
1329 B2INFO(f"All {len(jobs)} requested jobs submitted")
1330

◆ _add_batch_directives()

_add_batch_directives ( self,
job,
batch_file )
protected
Add PBS directives to submitted script.

Reimplemented from Batch.

Definition at line 1378 of file backends.py.

1378 def _add_batch_directives(self, job, batch_file):
1379 """
1380 Add PBS directives to submitted script.
1381 """
1382 job_backend_args = {**self.backend_args, **job.backend_args}
1383 batch_queue = job_backend_args["queue"]
1384 print("#!/bin/bash", file=batch_file)
1385 print("# --- Start PBS ---", file=batch_file)
1386 print(" ".join([PBS.cmd_queue, batch_queue]), file=batch_file)
1387 print(" ".join([PBS.cmd_name, job.name]), file=batch_file)
1388 print(" ".join([PBS.cmd_wkdir, job.working_dir.as_posix()]), file=batch_file)
1389 print(" ".join([PBS.cmd_stdout, Path(job.working_dir, _STDOUT_FILE).as_posix()]), file=batch_file)
1390 print(" ".join([PBS.cmd_stderr, Path(job.working_dir, _STDERR_FILE).as_posix()]), file=batch_file)
1391 print("# --- End PBS ---", file=batch_file)
1392

◆ _add_setup()

_add_setup ( job,
batch_file )
staticprotectedinherited
Adds setup lines to the shell script file.

Definition at line 806 of file backends.py.

806 def _add_setup(job, batch_file):
807 """
808 Adds setup lines to the shell script file.
809 """
810 for line in job.setup_cmds:
811 print(line, file=batch_file)
812

◆ _add_wrapper_script_setup()

_add_wrapper_script_setup ( self,
job,
batch_file )
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 813 of file backends.py.

813 def _add_wrapper_script_setup(self, job, batch_file):
814 """
815 Adds lines to the submitted script that help with job monitoring/setup. Mostly here so that we can insert
816 `trap` statements for Ctrl-C situations.
817 """
818 start_wrapper = f"""# ---
819# trap ctrl-c and call ctrl_c()
820trap '(ctrl_c 130)' SIGINT
821trap '(ctrl_c 143)' SIGTERM
822
823function write_exit_code() {{
824 echo "Writing $1 to exit status file"
825 echo "$1" > {self.exit_code_file}
826 exit $1
827}}
828
829function ctrl_c() {{
830 trap '' SIGINT SIGTERM
831 echo "** Trapped Ctrl-C **"
832 echo "$1" > {self.exit_code_file}
833 exit $1
834}}
835# ---"""
836 print(start_wrapper, file=batch_file)
837

◆ _add_wrapper_script_teardown()

_add_wrapper_script_teardown ( self,
job,
batch_file )
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 838 of file backends.py.

838 def _add_wrapper_script_teardown(self, job, batch_file):
839 """
840 Adds lines to the submitted script that help with job monitoring/teardown. Mostly here so that we can insert
841 an exit code of the job cmd being written out to a file. Which means that we can know if the command was
842 successful or not even if the backend server/monitoring database purges the data about our job i.e. If PBS
843 removes job information too quickly we may never know if a job succeeded or failed without some kind of exit
844 file.
845 """
846 end_wrapper = """# ---
847write_exit_code $?"""
848 print(end_wrapper, file=batch_file)
849

◆ _create_cmd()

_create_cmd ( self,
script_path )
protected
 

Reimplemented from Batch.

Definition at line 1401 of file backends.py.

1401 def _create_cmd(self, script_path):
1402 """
1403 """
1404 submission_cmd = self.submission_cmds[:]
1405 submission_cmd.append(script_path.as_posix())
1406 return submission_cmd
1407

◆ _create_job_result()

_create_job_result ( cls,
job,
batch_output )
protected
 

Reimplemented from Batch.

Definition at line 1394 of file backends.py.

1394 def _create_job_result(cls, job, batch_output):
1395 """
1396 """
1397 job_id = batch_output.replace("\n", "")
1398 B2INFO(f"Job ID of {job} recorded as: {job_id}")
1399 job.result = cls.PBSResult(job, job_id)
1400

◆ _create_parent_job_result()

_create_parent_job_result ( cls,
parent )
protected
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 from Backend.

Definition at line 1417 of file backends.py.

1417 def _create_parent_job_result(cls, parent):
1418 parent.result = cls.PBSResult(parent, None)
1419

◆ _make_submit_file()

_make_submit_file ( self,
job,
submit_file_path )
protectedinherited
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 1179 of file backends.py.

1179 def _make_submit_file(self, job, submit_file_path):
1180 """
1181 Useful for the HTCondor backend where a submit is needed instead of batch
1182 directives pasted directly into the submission script. It should be overwritten
1183 if needed.
1184 """
1185

◆ _submit_to_batch()

_submit_to_batch ( cls,
cmd )
protected
Do the actual batch submission command and collect the output to find out the job id for later monitoring.

Reimplemented from Batch.

Definition at line 1409 of file backends.py.

1409 def _submit_to_batch(cls, cmd):
1410 """
1411 Do the actual batch submission command and collect the output to find out the job id for later monitoring.
1412 """
1413 sub_out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
1414 return sub_out
1415

◆ can_submit()

can_submit ( self,
njobs = 1 )
Checks the global number of jobs in PBS right now (submitted or running) for this user.
Returns True if the number is lower that the limit, False if it is higher.

Parameters:
    njobs (int): The number of jobs that we want to submit before checking again. Lets us check if we
        are sufficiently below the limit in order to (somewhat) safely submit. It is slightly dangerous to
        assume that it is safe to submit too many jobs since there might be other processes also submitting jobs.
        So njobs really shouldn't be abused when you might be getting close to the limit i.e. keep it <=250
        and check again before submitting more.

Reimplemented from Batch.

Definition at line 1509 of file backends.py.

1509 def can_submit(self, njobs=1):
1510 """
1511 Checks the global number of jobs in PBS right now (submitted or running) for this user.
1512 Returns True if the number is lower that the limit, False if it is higher.
1513
1514 Parameters:
1515 njobs (int): The number of jobs that we want to submit before checking again. Lets us check if we
1516 are sufficiently below the limit in order to (somewhat) safely submit. It is slightly dangerous to
1517 assume that it is safe to submit too many jobs since there might be other processes also submitting jobs.
1518 So njobs really shouldn't be abused when you might be getting close to the limit i.e. keep it <=250
1519 and check again before submitting more.
1520 """
1521 B2DEBUG(29, "Calling PBS().can_submit()")
1522 job_info = self.qstat(username=os.environ["USER"])
1523 total_jobs = job_info["NJOBS"]
1524 B2INFO(f"Total jobs active in the PBS system is currently {total_jobs}")
1525 if (total_jobs + njobs) > self.global_job_limit:
1526 B2INFO(f"Since the global limit is {self.global_job_limit} we cannot submit {njobs} jobs until some complete.")
1527 return False
1528 else:
1529 B2INFO("There is enough space to submit more jobs.")
1530 return True
1531

◆ create_job_record_from_element()

create_job_record_from_element ( job_elem)
static
Creates a Job dictionary with various job information from the XML element returned by qstat.

Parameters:
    job_elem (xml.etree.ElementTree.Element): The XML Element of the Job

Returns:
    dict: JSON serialisable dictionary of the Job information we are interested in.

Definition at line 1601 of file backends.py.

1601 def create_job_record_from_element(job_elem):
1602 """
1603 Creates a Job dictionary with various job information from the XML element returned by qstat.
1604
1605 Parameters:
1606 job_elem (xml.etree.ElementTree.Element): The XML Element of the Job
1607
1608 Returns:
1609 dict: JSON serialisable dictionary of the Job information we are interested in.
1610 """
1611 job_dict = {}
1612 job_dict["Job_Id"] = job_elem.find("Job_Id").text
1613 job_dict["Job_Name"] = job_elem.find("Job_Name").text
1614 job_dict["Job_Owner"] = job_elem.find("Job_Owner").text
1615 job_dict["job_state"] = job_elem.find("job_state").text
1616 job_dict["queue"] = job_elem.find("queue").text
1617 return job_dict
1618
1619

◆ get_batch_submit_script_path()

get_batch_submit_script_path ( self,
job )
inherited
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 1331 of file backends.py.

1331 def get_batch_submit_script_path(self, job):
1332 """
1333 Construct the Path object of the script file that we will submit using the batch command.
1334 For most batch backends this is the same script as the bash script we submit.
1335 But for some they require a separate submission file that describes the job.
1336 To implement that you can implement this function in the Backend class.
1337 """
1338 return Path(job.working_dir, self.submit_script)
1339

◆ get_submit_script_path()

get_submit_script_path ( self,
job )
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 859 of file backends.py.

859 def get_submit_script_path(self, job):
860 """
861 Construct the Path object of the bash script file that we will submit. It will contain
862 the actual job command, wrapper commands, setup commands, and any batch directives
863 """
864 return Path(job.working_dir, self.submit_script)
865
866

◆ qstat()

qstat ( cls,
username = "",
job_ids = None )
Simplistic interface to the ``qstat`` command. Lets you request information about all jobs or ones matching the filter
['job_id'] or for the username. The result is a JSON dictionary containing come of the useful job attributes returned
by qstat.

PBS is kind of annoying as depending on the configuration it can forget about jobs immediately. So the status of a
finished job is VERY hard to get. There are other commands that are sometimes included that may do a better job.
This one should work for Melbourne's cloud computing centre.

Keyword Args:
    username (str): The username of the jobs we are interested in. Only jobs corresponding to the <username>@hostnames
        will be in the output dictionary.
    job_ids (list[str]): List of Job ID strings, each given by qstat during submission. If this argument is given then
        the output of this function will be only information about this jobs. If this argument is not given, then all jobs
        matching the other filters will be returned.

Returns:
    dict: JSON dictionary of the form (to save you parsing the XML that qstat returns).:

    .. code-block:: python

      {
        "NJOBS": int
        "JOBS":[
                {
                  <key: value>, ...
                }, ...
               ]
      }

Definition at line 1533 of file backends.py.

1533 def qstat(cls, username="", job_ids=None):
1534 """
1535 Simplistic interface to the ``qstat`` command. Lets you request information about all jobs or ones matching the filter
1536 ['job_id'] or for the username. The result is a JSON dictionary containing come of the useful job attributes returned
1537 by qstat.
1538
1539 PBS is kind of annoying as depending on the configuration it can forget about jobs immediately. So the status of a
1540 finished job is VERY hard to get. There are other commands that are sometimes included that may do a better job.
1541 This one should work for Melbourne's cloud computing centre.
1542
1543 Keyword Args:
1544 username (str): The username of the jobs we are interested in. Only jobs corresponding to the <username>@hostnames
1545 will be in the output dictionary.
1546 job_ids (list[str]): List of Job ID strings, each given by qstat during submission. If this argument is given then
1547 the output of this function will be only information about this jobs. If this argument is not given, then all jobs
1548 matching the other filters will be returned.
1549
1550 Returns:
1551 dict: JSON dictionary of the form (to save you parsing the XML that qstat returns).:
1552
1553 .. code-block:: python
1554
1555 {
1556 "NJOBS": int
1557 "JOBS":[
1558 {
1559 <key: value>, ...
1560 }, ...
1561 ]
1562 }
1563 """
1564 B2DEBUG(29, f"Calling PBS.qstat(username='{username}', job_id={job_ids})")
1565 if not job_ids:
1566 job_ids = []
1567 job_ids = set(job_ids)
1568 cmd_list = ["qstat", "-x"]
1569 # We get an XML serialisable summary from qstat. Requires the shell argument.
1570 cmd = " ".join(cmd_list)
1571 B2DEBUG(29, f"Calling subprocess with command = '{cmd}'")
1572 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True)
1573 jobs_dict = {"NJOBS": 0, "JOBS": []}
1574 jobs_xml = ET.fromstring(output)
1575
1576 # For a specific job_id we can be a bit more efficient in XML parsing
1577 if len(job_ids) == 1:
1578 job_elem = jobs_xml.find(f"./Job[Job_Id='{list(job_ids)[0]}']")
1579 if job_elem:
1580 jobs_dict["JOBS"].append(cls.create_job_record_from_element(job_elem))
1581 jobs_dict["NJOBS"] = 1
1582 return jobs_dict
1583
1584 # Since the username given is not exactly the same as the one that PBS stores (<username>@host)
1585 # we have to simply loop through rather than using XPATH.
1586 for job in jobs_xml.iterfind("Job"):
1587 job_owner = job.find("Job_Owner").text.split("@")[0]
1588 if username and username != job_owner:
1589 continue
1590 job_id = job.find("Job_Id").text
1591 if job_ids and job_id not in job_ids:
1592 continue
1593 jobs_dict["JOBS"].append(cls.create_job_record_from_element(job))
1594 jobs_dict["NJOBS"] += 1
1595 # Remove it so that we don't keep checking for it
1596 if job_id in job_ids:
1597 job_ids.remove(job_id)
1598 return jobs_dict
1599

◆ submit()

submit ( self,
job,
check_can_submit = True,
jobs_per_check = 100 )
inherited
 

Reimplemented from Backend.

Definition at line 1204 of file backends.py.

1204 def submit(self, job, check_can_submit=True, jobs_per_check=100):
1205 """
1206 """
1207 raise NotImplementedError("This is an abstract submit(job) method that shouldn't have been called. "
1208 "Did you submit a (Sub)Job?")
1209

Member Data Documentation

◆ backend_args

dict backend_args = {**self.default_backend_args, **backend_args}
inherited

The backend args that will be applied to jobs unless the job specifies them itself.

Definition at line 796 of file backends.py.

◆ cmd_name

str cmd_name = "#PBS -N"
static

Job name directive.

Definition at line 1365 of file backends.py.

◆ cmd_queue

str cmd_queue = "#PBS -q"
static

Queue directive.

Definition at line 1363 of file backends.py.

◆ cmd_stderr

str cmd_stderr = "#PBS -e"
static

stderr file directive

Definition at line 1361 of file backends.py.

◆ cmd_stdout

str cmd_stdout = "#PBS -o"
static

stdout file directive

Definition at line 1359 of file backends.py.

◆ cmd_wkdir

str cmd_wkdir = "#PBS -d"
static

Working directory directive.

Definition at line 1357 of file backends.py.

◆ default_backend_args

dict default_backend_args = {}
staticinherited

Default backend_args.

Definition at line 788 of file backends.py.

◆ default_global_job_limit

int default_global_job_limit = 1000
staticinherited

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 1155 of file backends.py.

◆ default_sleep_between_submission_checks

int default_sleep_between_submission_checks = 30
staticinherited

Default time betweeon re-checking if the active jobs is below the global job limit.

Definition at line 1157 of file backends.py.

◆ exit_code_file

str exit_code_file = "__BACKEND_CMD_EXIT_STATUS__"
staticinherited

Default exit code file name.

Definition at line 786 of file backends.py.

◆ global_job_limit

int global_job_limit = self.default_global_job_limit
inherited

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 1166 of file backends.py.

◆ sleep_between_submission_checks

sleep_between_submission_checks = self.default_sleep_between_submission_checks
inherited

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 1169 of file backends.py.

◆ submission_cmds

list submission_cmds = []
staticinherited

Shell command to submit a script, should be implemented in the derived class.

Definition at line 1142 of file backends.py.

◆ submit_script

submit_script = "submit.sh"
staticinherited

Default submission script name.

Definition at line 784 of file backends.py.


The documentation for this class was generated from the following file: