Package schrodinger :: Package job :: Module queue :: Class JobControlJob
[hide private]
[frames] | no frames]

Class JobControlJob

object --+    
         |    
   BaseJob --+
             |
            JobControlJob
Known Subclasses:

This class defines a job control job to be run under JobDJ.

Instance Methods [hide private]
 
__init__(self, command, command_dir=None, name=None, max_retries=None, timeout=None, launch_env_variables=None, **kwargs)
Job constructor.
 
getJob(self)
Return the job record as a schrodinger.job.jobcontrol.Job instance.
 
runsLocally(self)
Return True if the job runs on the JobDJ control host, False if not.
 
_readAgain(self)
Update the jobcontrol.Job object from the database.
 
__getstate__(self)
Return the object state to be serialized by pickle.
 
__setstate__(self, state_dict)
Reset state from a pickle.
 
update(self)
Checks for changes in job status, and updates the object appropriately (marks for restart, etc).
 
_markFinished(self, action)
Marks the job as finished.
 
_hasDied(self, action)
Tells JobDJ to restart the job next-time-around.
 
doCommand(self, host, local)
Launch job on specified host using jobcontrol.launch_job().
 
getCommand(self)
A hook method that can allow for the command to be generated at run time.
 
cancelSubmitted(self)
If the job is still in the 'submitted' state, cancel it, purge the jobrecord and set the job handle to None.
 
retryFailure(self, max_retries=0)
This method will be called when the job has failed, and JobDJ needs to know whether the job should be retried or not.
 
kill(self)
Send kill request to jobcontrol managed job
 
maxFailuresReached(self, msg)
Print an error summary, including the last 20 lines of the first log file from the LogFiles list in the job record.
 
getStatusStrings(self)
Return a tuple of status strings for printing by JobDJ.
 
__str__(self)
str(x)

Inherited from BaseJob: __lt__, addFinalizer, addGroupPrereq, addPrereq, finalize, genAllJobs, genAllPrereqs, getCommandDir, getJobDJ, getPrereqs, hasStarted, isComplete, postCommand, preCommand, run, setup

Inherited from BaseJob (private): _getState, _pruneGraph, _setState

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]

Inherited from BaseJob: init_count

Properties [hide private]

Inherited from BaseJob: state

Inherited from object: __class__

Method Details [hide private]

__init__(self, command, command_dir=None, name=None, max_retries=None, timeout=None, launch_env_variables=None, **kwargs)
(Constructor)

 

Job constructor.

Parameters:
  • command (List of strings.) - The command that runs the job.
  • command_dir (pathname) - The directory from which to run the command.
  • name (string) - The name of the job.
  • max_retries (int) - Number of allowed retries for this job. If this is set, it is never overridden by the SCHRODINGER_MAX_RETRIES environment variable. If it is not set, the value of max_retries defined in JobDJ is used, and SCHRODINGER_MAX_RETRIES can be used to override this value at runtime. To prevent this job from being restarted altogether, set max_retries to zero.
  • timeout (int) - Timeout (in seconds) after which the job will be killed. If None, the job is allowed to run indefinitely.
  • launch_env_variables (dict) - A dictionary with the environment variables to add when the jobcontrol job is launched. The name of any additional variables to set should be in the keyword of the dict and the value should be the corresponding value. These will be added to any environment variables already present, but removed after the job has been launched.
  • kwargs (dict) - Additional keyword arguments. Provided for consistency of interface in subclasses.
Overrides: object.__init__

getJob(self)

 

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn't been launched.

runsLocally(self)

 

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don't need hosts.

There is no limit on the number of locally run jobs.

Overrides: BaseJob.runsLocally
(inherited documentation)

_readAgain(self)

 

Update the jobcontrol.Job object from the database.

Returns:
True if the record was successfully updated, False if not. Failures to update are usually due to high network traffic.
Raises:
  • Runtime - If the job record is missing.

update(self)

 

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

Overrides: BaseJob.update

doCommand(self, host, local)

 

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) - Host on which the job will be executed.
  • local (bool) - Should "-LOCAL" be appended to the command?
Overrides: BaseJob.doCommand

cancelSubmitted(self)

 

If the job is still in the 'submitted' state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

retryFailure(self, max_retries=0)

 

This method will be called when the job has failed, and JobDJ needs to know whether the job should be retried or not.

JobDJ's value for the max_retries parameter is passed in, to be used when the job doesn't have its own max_retries value.

Return True if this job should be retried, otherwise False.

maxFailuresReached(self, msg)

 

Print an error summary, including the last 20 lines of the first log file from the LogFiles list in the job record.

Overrides: BaseJob.maxFailuresReached

getStatusStrings(self)

 

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, name, host).

Overrides: BaseJob.getStatusStrings
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)