cerise.job_store package¶
Submodules¶
cerise.job_store.job_state module¶
-
class
cerise.job_store.job_state.
JobState
[source]¶ Bases:
enum.Enum
Enum JobState
-
CANCELLED
= 'Cancelled'¶
-
FINISHED
= 'Finished'¶
-
PERMANENT_FAILURE
= 'PermanentFailure'¶
-
RUNNING
= 'Running'¶
-
RUNNING_CR
= 'RunningCR'¶
-
STAGING_IN
= 'StagingIn'¶
-
STAGING_IN_CR
= 'StagingCR'¶
-
STAGING_OUT
= 'Destaging'¶
-
STAGING_OUT_CR
= 'DestagingCR'¶
-
SUBMITTED
= 'Submitted'¶
-
SUCCESS
= 'Success'¶
-
SYSTEM_ERROR
= 'SystemError'¶
-
TEMPORARY_FAILURE
= 'TemporaryFailure'¶
-
WAITING
= 'Waiting'¶
-
WAITING_CR
= 'WaitingCR'¶
-
cerise.job_store.sqlite_job module¶
-
class
cerise.job_store.sqlite_job.
SQLiteJob
(store: Any, job_id: str)[source]¶ Bases:
object
This class provides the internal representation of a job. These are stored inside the service. Note that there is also a JobDescription, which is defined in the Swagger definition and part of the REST API, and a Cerulean JobDescription class, which describes a job to start on a remote compute resource.
Creates a new SQLiteJob object.
This contains only a job id and a reference to the store; the data about the job are in the database.
Parameters: - store (SQLiteJobStore) – The store this job is stored by
- id – The id of the job, a string containing a GUID
-
add_log
(level: int, message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log.
Parameters: - level – Level of importance
- message – The log message.
-
critical
(message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log at level CRITICAL.
Parameters: message – The log message.
-
debug
(message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log at level DEBUG.
Parameters: message – The log message.
-
error
(message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log at level ERROR.
Parameters: message – The log message.
-
id
= None¶ Job id, a string containing a UUID.
Type: str
-
info
(message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log at level INFO.
Parameters: message – The log message.
-
local_input
¶ Input JSON string, as specified by the submitter.
-
local_output
¶ The serialised JSON output object describing the destaged outputs.
-
log
¶ Log output as of last update.
-
name
¶ Name, as specified by the submitter.
-
please_delete
¶ Whether the job should be deleted.
-
remote_error
¶ cwl-runner stderr output as of last update.
-
remote_input_path
¶ The absolute remote path of the input description file.
-
remote_job_id
¶ The id the remote scheduler gave to this job.
-
remote_output
¶ cwl-runner output as of last update.
-
remote_stderr_path
¶ The absolute remote path of the standard error dump.
-
remote_stdout_path
¶ The absolute remote path of the standard output dump.
-
remote_system_err_path
¶ The absolute remote path of the system error dump.
-
remote_system_out_path
¶ The absolute remote path of the system out dump.
-
remote_workdir_path
¶ The absolute remote path of the working directory.
-
remote_workflow_path
¶ The absolute remote path of the CWL workflow file.
-
required_num_cores
¶ The number of cores to reserve for this workflow.
-
resolve_retry_count
¶ How many times we’ve tried to resolve.
-
state
¶ Current state of the job.
-
time_limit
¶ The time to reserve, in seconds. If 0, use cluster default.
-
try_transition
(from_state: cerise.job_store.job_state.JobState, to_state: cerise.job_store.job_state.JobState) → bool[source]¶ Attempts to transition the job’s state to a new one.
If the current state equals from_state, it is set to to_state, and True is returned, otherwise False is returned and the current state remains what it was.
Parameters: - from_state – The expected current state
- to_state – The desired next state
Returns: True iff the transition was successful.
-
warning
(message: Union[str, List[str]]) → None[source]¶ Add a message to the job’s log at level WARNING.
Parameters: message – The log message.
-
workflow
¶ Workflow file URI, as specified by the submitter.
-
workflow_content
¶ The content of the workflow description file, or None if it has not been resolved yet.
cerise.job_store.sqlite_job_store module¶
-
class
cerise.job_store.sqlite_job_store.
SQLiteJobStore
(dbfile: str)[source]¶ Bases:
object
A JobStore that stores jobs in a SQLite database. You must acquire the store to do anything with it or the jobs stored in it. It’s a context manager, so use a with statement:
- with self._store:
- job = self._store.get_job(id) # go ahead and modify job
# don’t touch self._store or keep any references to jobs
Having multiple nested with statements is okay, so you can call other functions that use the store and acquire it themselves without incident.
Parameters: dbfile (str) – The path to the file storing the database. -
create_job
(name: str, workflow: str, job_input: str) → str[source]¶ Create a job.
Parameters: - name – The user-assigned name of the job
- workflow – A string containing a URL pointing to the workflow
- job_input – A string containing a json description of a json string.
Returns: A string containing the job id.
-
delete_job
(job_id: str) → None[source]¶ Delete the job with the given id.
Parameters: job_id – A string containing the id of the job to be deleted.