![]() |
Belle II Software development
|
Public Member Functions | |
__init__ (self, job, subjob_id, input_files=None) | |
output_dir (self) | |
working_dir (self) | |
name (self) | |
status (self) | |
status (self, status) | |
subjobs (self) | |
job_dict (self) | |
__getattr__ (self, attribute) | |
__repr__ (self) | |
ready (self) | |
update_status (self) | |
create_subjob (self, i, input_files=None, args=None) | |
dump_to_json (self, file_path) | |
from_json (cls, file_path) | |
dump_input_data (self) | |
copy_input_sandbox_files_to_working_dir (self) | |
check_input_data_files (self) | |
full_command (self) | |
append_current_basf2_setup_cmds (self) | |
Public Attributes | |
id = subjob_id | |
Id of Subjob. | |
parent = job | |
Job() instance of parent to this SubJob. | |
splitter = None | |
The SubjobSplitter used to create subjobs if necessary. | |
list | input_sandbox_files = [] |
Files to be copied directly into the working directory (pathlib.Path ). | |
list | output_patterns = [] |
Files that we produce during the job and want to be returned. | |
list | cmd = [] |
Command and arguments as a list that will be run by the job on the backend. | |
list | args = [] |
The arguments that will be applied to the cmd (These are ignored by SubJobs as they have their own arguments) | |
list | input_files = [] |
Input files to job (str ), a list of these is copied to the working directory. | |
list | setup_cmds = [] |
Bash commands to run before the main self.cmd (mainly used for batch system setup) | |
dict | backend_args = {} |
Config dictionary for the backend to use when submitting the job. | |
result = None | |
The result object of this Job. | |
Static Public Attributes | |
dict | statuses = {"init": 0, "submitted": 1, "running": 2, "failed": 3, "completed": 4} |
Allowed Job status dictionary. | |
list | exit_statuses = ["failed", "completed"] |
Job statuses that correspond to the Job being finished (successfully or not) | |
Protected Member Functions | |
_get_overall_status_from_subjobs (self) | |
Protected Attributes | |
str | _status = "init" |
The actual status of the overall Job . | |
This mini-class simply holds basic information about which subjob you are and a reference to the parent Job object to be able to access the main data there. Rather than replicating all of the parent job's configuration again.
Definition at line 677 of file backends.py.
__init__ | ( | self, | |
job, | |||
subjob_id, | |||
input_files = None ) |
Definition at line 684 of file backends.py.
__getattr__ | ( | self, | |
attribute ) |
Since a SubJob uses attributes from the parent Job, everything simply accesses the Job attributes unless otherwise specified.
Definition at line 759 of file backends.py.
__repr__ | ( | self | ) |
Definition at line 766 of file backends.py.
|
protectedinherited |
Definition at line 462 of file backends.py.
|
inherited |
This adds simple setup commands like ``source /path/to/tools/b2setup`` to your `Job`. It should detect if you are using a local release or CVMFS and append the correct commands so that the job will have the same basf2 release environment. It should also detect if a local release is not compiled with the ``opt`` option. Note that this *doesn't mean that every environment variable is inherited* from the submitting process environment.
Definition at line 639 of file backends.py.
|
inherited |
Check the input files and make sure that there aren't any duplicates. Also check if the files actually exist if possible.
Definition at line 597 of file backends.py.
|
inherited |
Get all of the requested files for the input sandbox and copy them to the working directory. Files like the submit.sh or input_data.json are not part of this process.
Definition at line 586 of file backends.py.
|
inherited |
Creates a subjob Job object that references that parent Job. Returns the SubJob object at the end.
Definition at line 434 of file backends.py.
|
inherited |
Dumps the `Job.input_files` attribute to a JSON file. input_files should be a list of string URI objects.
Definition at line 578 of file backends.py.
|
inherited |
Dumps the Job object configuration to a JSON file so that it can be read in again later. Parameters: file_path(`basf2.Path`): The filepath we'll dump to
Definition at line 537 of file backends.py.
|
inherited |
Definition at line 550 of file backends.py.
|
inherited |
Returns: str: The full command that this job will run including any arguments.
Definition at line 627 of file backends.py.
job_dict | ( | self | ) |
Returns: dict: A JSON serialisable representation of the `SubJob`. `Path <basf2.Path>` objects are converted to `string` via ``Path.as_posix()``. Since Subjobs inherit most of the parent job's config we only output the input files and arguments that are specific to this subjob and no other details.
Reimplemented from Job.
Definition at line 746 of file backends.py.
name | ( | self | ) |
Getter for name of SubJob. Accesses the parent Job name to infer this.
Reimplemented from Job.
Definition at line 715 of file backends.py.
output_dir | ( | self | ) |
Getter for output_dir of SubJob. Accesses the parent Job output_dir to infer this.
Reimplemented from Job.
Definition at line 704 of file backends.py.
|
inherited |
Returns whether or not the Job has finished. If the job has subjobs then it will return true when they are all finished. It will return False as soon as it hits the first failure. Meaning that you cannot guarantee that all subjobs will have their status updated when calling this method. Instead use :py:meth:`update_status` to update all statuses if necessary.
Definition at line 411 of file backends.py.
status | ( | self | ) |
Returns the status of this SubJob.
Reimplemented from Job.
Definition at line 720 of file backends.py.
status | ( | self, | |
status ) |
Sets the status of this Job.
Reimplemented from Job.
Definition at line 727 of file backends.py.
subjobs | ( | self | ) |
A subjob cannot have subjobs. Always return empty list.
Reimplemented from Job.
Definition at line 739 of file backends.py.
|
inherited |
Calls :py:meth:`update_status` on the job's result. The result object should update all of the subjobs (if there are any) in the best way for the type of result object/backend.
Definition at line 423 of file backends.py.
working_dir | ( | self | ) |
Getter for working_dir of SubJob. Accesses the parent Job working_dir to infer this.
Reimplemented from Job.
Definition at line 710 of file backends.py.
|
protectedinherited |
The actual status of the overall Job
.
The property handles querying for the subjob status to set this
Definition at line 403 of file backends.py.
|
inherited |
The arguments that will be applied to the cmd
(These are ignored by SubJobs as they have their own arguments)
Definition at line 375 of file backends.py.
|
inherited |
Config dictionary for the backend to use when submitting the job.
Saves us from having multiple attributes that may or may not be used.
Definition at line 382 of file backends.py.
|
inherited |
Command and arguments as a list that will be run by the job on the backend.
Definition at line 373 of file backends.py.
|
staticinherited |
Job statuses that correspond to the Job being finished (successfully or not)
Definition at line 352 of file backends.py.
id = subjob_id |
Id of Subjob.
Definition at line 688 of file backends.py.
|
inherited |
Input files to job (str
), a list of these is copied to the working directory.
Definition at line 377 of file backends.py.
|
inherited |
Files to be copied directly into the working directory (pathlib.Path
).
Not the input root files, those should be in Job.input_files
.
Definition at line 365 of file backends.py.
|
inherited |
Files that we produce during the job and want to be returned.
Can use wildcard (*)
Definition at line 371 of file backends.py.
parent = job |
Job() instance of parent to this SubJob.
Definition at line 690 of file backends.py.
|
inherited |
The result object of this Job.
Only filled once the job is submitted to a backend since the backend creates a special result class depending on its type.
Definition at line 401 of file backends.py.
|
inherited |
Bash commands to run before the main self.cmd (mainly used for batch system setup)
Definition at line 379 of file backends.py.
|
inherited |
The SubjobSplitter
used to create subjobs if necessary.
Definition at line 360 of file backends.py.
|
staticinherited |
Allowed Job status dictionary.
The key is the status name and the value is its level. The lowest level out of all subjobs is the one that is the overall status of the overall job.
Definition at line 349 of file backends.py.