Job

Module to handle a job.

class qarnot.job.Job(connection, name, pool=None, shortname=None, use_dependencies=False)[source]

Bases: object

Represents a Qarnot job.

__init__(connection, name, pool=None, shortname=None, use_dependencies=False)[source]

Create a new Job.

Parameters:
  • connection (qarnot.connection.Connection) – the cluster on which to send the job
  • name (str) – given name of the job
  • pool (Pool or None) – which Pool to submit the job in,
  • shortname (str) – userfriendly job name
  • use_dependencies – allow dependencies between tasks in this job
auto_update
Type:bool
Getter:Returns this job’s auto update state
Setter:Sets this job’s auto update state

Auto update state, default to True When auto update is disabled properties will always return cached value for the object and a call to update() will be required to get latest values from the REST Api.

update_cache_time
Type:int
Getter:Returns this job’s auto update state
Setter:Sets this job’s auto update state

Cache expiration time, default to 5s

state
Type:str
Getter:return this job’s state

State of the job.

Value is in
  • UnSubmitted
  • Active,
  • Terminating,
  • Completed,
  • Deleting

Warning

this is the state of the job when the object was retrieved, call update() for up to date value.

tasks
Type:List of Task
Getter:Returns this job tasks

The tasks submitted in this job.

use_dependencies
Type:bool
Getter:task’s job can have dependencies
Setter:Set if there is task’s job dependencies

Can be set until submit() is called.

uuid
Type:str
Getter:Returns this job’s uuid

The job’s uuid.

Automatically set when a job is submitted.

name
Type:str
Getter:Returns this job’s name
Setter:Sets this job’s name

The job’s name.

Can be set until job is submitted.

shortname
Type:str
Getter:Returns this job’s shortname
Setter:Sets this job’s shortname

The job’s shortname, must be DNS compliant and unique, if not provided, will default to uuid.

Can be set until job is submitted.

creation_date
Type:str
Getter:Returns this job’s creation date

Creation date of the job (UTC Time)

max_wall_time
Type:str
Getter:Returns this job’s maximum wall time
Setter:Sets this job’s maximum wall time

The job’s maximum wall time. It is a time span string. Format example: ‘d.hh:mm:ss’ or ‘hh:mm:ss’

Can be set until job is submitted.

pool
Type:Pool
Getter:Returns this job’s pool
Setter:Sets this job’s pool

The pool to run the job in.

Can be set until submit() is called.

classmethod from_json(connection, payload)[source]

Create a Job object from a json job.

Parameters:
Returns:

The created Job.

submit()[source]

Submit job to the cluster if it is not already submitted.

Raises:
update(flushcache=False)[source]

Update the job object from the REST Api. The flushcache parameter can be used to force the update, otherwise a cached version of the object will be served when accessing properties of the object. Cache behavior is configurable with auto_update and update_cache_time.

Raises:
terminate()[source]

Terminate this job on the server and abort all remaining tasks in the job.

Raises:
delete(forceAbort=False)[source]

Delete this job on the server.

The forceAbort parameter can be used to force running task in the job to be aborted,

Raises:
auto_delete

Autodelete this job if it is finished and your max number of job is reach

Can be set until submit() is called.

Type:bool
Getter:Returns is this job must autodelete
Setter:Sets this job’s autodelete
Default_value:“False”
Raises:AttributeError – if you try to reset the auto_delete after the job is submit
completion_ttl

The job will be auto delete completion_ttl after it is finished

Can be set until submit() is called.

Getter:Returns this job’s completed time to live.
Type:str
Setter:Sets this job’s this job’s completed time to live.
Type:str or datetime.timedelta
Default_value:“”
Raises:AttributeError – if you try to set it after the job is submitted

The completion_ttl must be a timedelta or a time span format string (example: ‘d.hh:mm:ss’ or ‘hh:mm:ss’)

__repr__() <==> repr(x)[source]