prisms_jobs.Job

class prisms_jobs.Job(name='STDIN', account=None, nodes=None, ppn=None, walltime=None, pmem=None, qos=None, queue=None, exetime=None, message='a', email=None, priority='0', constraint=None, command=None, auto=False, substr=None)[source]

Bases: object

Represents a computational job

Initialize either with all the parameters, or with ‘substr’ a submit script as a string. If ‘substr’ is given, all other arguments are ignored.

Parameters:
  • substr (str) – A submit script as a string.
  • name (str) –

    Job name. Ex: "myjob-0"

    The name specified may be up to and including 15 characters in length. It must consist of printable, non white space characters with the first character alphabetic.

  • account (str) – Account name. Ex: "prismsproject_fluxoe"
  • nodes (int) – Number of nodes. Ex: 2
  • ppn (int) – Processors per node. Ex: 16
  • walltime (str) – Walltime (HH:MM:SS). Ex: "10:00:00"
  • pmem (str) – Memory requsted. Ex: "3800mb"
  • qos (str) – Ex: "flux"
  • queue (str) – Ex: "fluxoe"
  • exetime (str) –

    Time after which the job is eligible for execution. Ex: "1100"

    Has the form: [[[[CC]YY]MM]DD]hhmm[.SS] Create using prisms_jobs.misc.exetime(deltatime), where deltatime is a [[[DD:]MM:]HH:]SS string.

  • message (str) –

    When to send email about the job. Ex: "abe"

    The mail_options argument is a string which consists of either the single character "n", or one or more of the characters "a", "b", and "e".

    If the character "n" is specified, no normal mail is sent. Mail for job cancels and other events outside of normal job processing are still sent.

    For the letters "a", "b", and "e":

    a mail is sent when the job is aborted by the batch system.
    b mail is sent when the job begins execution.
    e mail is sent when the job terminates.
  • email (str) –

    Where to send notifications. Ex: "jdoe@umich.edu"

    The email string is of the form: user[@host][,user[@host],...]

  • priority (str) – Priority ranges from (low) -1024 to (high) 1023. Ex: "-200"
  • command (str) – String with command to run by script. Ex: "echo "hello" > test.txt"
  • auto (bool, optional, Default=False) –

    Indicates an automatically re-submitting job. Ex: True

    Only set to True if the command uses this prisms_jobs module to set itself as completed when it is completed. Otherwise, you may submit it extra times leading to wasted resources and overwritten data.

name

Job name. Ex: "myjob-0"

Type:str
account

Account name. Ex: "prismsproject_fluxoe"

Type:str
nodes

Number of nodes. Ex: 2

Type:int
ppn

Processors per node. Ex: 16

Type:int
walltime

Walltime (HH:MM:SS). Ex: "10:00:00"

Type:str
pmem

Memory requsted. Ex: "3800mb"

Type:str
qos

Ex: "flux"

Type:str
queue

Ex: "fluxoe"

Type:str
exetime

Time after which the job is eligible for execution. Ex: "1100"

Type:str
message

When to send email about the job. Ex: "abe"

Type:str
email

Where to send notifications. Ex: "jdoe@umich.edu"

Type:str
priority

Priority ranges from (low) -1024 to (high) 1023. Ex: "-200"

Type:str
constraint

Constraint. Ex: "haswell"

Type:str
command

String with command to run by script. Ex: "echo "hello" > test.txt"

Type:str
auto

Indicates an automatically re-submitting job. Ex: True

Type:bool
__init__(name='STDIN', account=None, nodes=None, ppn=None, walltime=None, pmem=None, qos=None, queue=None, exetime=None, message='a', email=None, priority='0', constraint=None, command=None, auto=False, substr=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([name, account, nodes, ppn, …]) Initialize self.
read(qsubstr) Set this Job object from string representing a submit script appropriate for the config.software().
script([filename]) Write this Job as a bash script
sub_string() Output Job as a string suitable for prisms_jobs.config.software()
submit([add, dbpath]) Submit this Job using the appropriate command for prisms_jobs.config.software().
read(qsubstr)[source]

Set this Job object from string representing a submit script appropriate for the config.software().

Parameters:qsubstr (str) – A submit script as a string
script(filename='submit.sh')[source]

Write this Job as a bash script

Parameters:filename (str) – Name of the script. Ex: “submit.sh”
sub_string()[source]

Output Job as a string suitable for prisms_jobs.config.software()

submit(add=True, dbpath=None)[source]

Submit this Job using the appropriate command for prisms_jobs.config.software().

Parameters:
  • add (bool) – Should this job be added to the JobDB database?
  • dbpath (str) – Specify a non-default JobDB database
Raises:

prisms_jobs.JobsError – If error submitting the job.