Job
Job(config)
Job class that holds the job configuration and status information. Internally stores most information in the JobConfig class, which is stored on disk as a snapshot of the Job. Jobs are not meant to be set up directly but rather via JobHandler.add_job().
config
The JobConfig instance that defines the initial job setup.
Properties
exitcode
Returns the exitcode of the job (str or int). If the exitcode in the config is still None, will get it from the backend first.
id
Returns the ID of the job (int).
log
Open the job log file with less.
Returns the log file path (str).
mode
Returns the mode the job is currently in (Mode). The job can either be ACTIVE or PASSIVE. If it is ACTIVE, status update is done by the job itself, otherwise it's done externally.
name
Returns the name of the job (str).
output
Returns the output path of the job (str).
parent_tags
Returns the list of parent tags associated to this job (set(str)).
script
Open the job script file with less.
Returns the script file path (str).
starttime
Returns the timestamp at which the job is started by the JobHandler (int).
status
Returns the status of the job (Status).
tags
Returns the list of tags associated to this job (set(str)).
type
Returns the type of the job (Type).
Member functions
add_tag
Job.add_tag(self, tag, is_parent=False)
Add tag to be associated to the job.
tag
Tag to add to the job.is_parent
Mark tag as parent.
add_tags
Job.add_tags(self, tags, is_parent=False)
Add a list of tags to be associated to the job.
tags
List of tags to add to the job.is_parent
Mark tags as parent.
cancel
Job.cancel(self, clear_retry=False)
Cancel the job.
clear_retry
Deactivate automatic retry mechanism
Returns the job status (Status).
complete
Job.complete(self)
Run the completion routine of the job.
edit_script
Job.edit_script(self, editor=None)
Open the job's run script in an editor.
editor
Command line editor to use. If none is specified, the editor specified in $EDITOR is used and if this is not set, the default editor according to the slurmy config is used.
get_mode
Job.get_mode(self, status)
Returns the mode the job is in while being in the specified status (Mode).
status
Status to return the job mode for.
get_status
Job.get_status(self, skip_eval=False, force_success_check=False)
Get the status of the job.
skip_eval
Skip the status evaluation and just return the stored value.force_success_check
Force the success routine to be run, even if the job is already in a post-finished state. This will not work if job is in PASSIVE mode (i.e. relies on a Listener to set it's status).
Returns the job status (Status).
has_tag
Job.has_tag(self, tag)
Check if the job has a given tag.
Returns if job has the tag (bool).
has_tags
Job.has_tags(self, tags)
Check if the job has any tag of a given list of tags.
tags
Set of tags.
Returns if job has any of the tags (bool).
reset
Job.reset(self, reset_retries=True)
Reset the job.
reset_retries
Also reset number of retries attempted so far.
set_mode
Job.set_mode(self, status, mode)
Set the mode the job will be in while being in the specified status.
status
Status for which the mode is set.mode
Mode that the job is set to for the given status.
submit
Job.submit(self)
Submit the job.
Returns the job status (Status).
update_snapshot
Job.update_snapshot(self)
Update the job snapshot on disk. Snaphot is only updated if something changed in the JobConfig.
wait
Job.wait(self)
If job is locally processing, wait for the process to finish.