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

Class SubprocessJob

         object --+    
                  |    
            BaseJob --+
                      |
     object --+       |
              |       |
RequirementsJob --+   |
                  |   |
       LocalhostJob --+
                      |
                     SubprocessJob
Known Subclasses:

A job for running an external process. By default, stdout and stderr are collected and made available as the 'stdout' and 'stderr' attributes when the job is completed.

Instance Methods [hide private]
 
__init__(self, command, command_dir=None, stdout=-1, stderr=-1)
If stdout or stderr are expected to be large, you can pass an open file object instead of using PIPE.
 
__getstate__(self)
Return the state to be pickled.
None
update(self)
Update the current job status.
None
doCommand(self, *args, **kwargs)
Execute the command associated with this job via subprocess.
 
kill(self)
Send termination request to subprocess managed job.
 
_endJob(self, force=False)
End a subprocess, ignoring errors from processes that have already completed.

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

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

Inherited from LocalhostJob: getRequirements

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

Class Variables [hide private]

Inherited from BaseJob: init_count

Inherited from LocalhostJob: requirement

Properties [hide private]

Inherited from BaseJob: state

Inherited from object: __class__

Method Details [hide private]

__init__(self, command, command_dir=None, stdout=-1, stderr=-1)
(Constructor)

 

If stdout or stderr are expected to be large, you can pass an open file object instead of using PIPE.

Parameters:
  • command_dir - The directory from which to run the command.
Overrides: object.__init__

update(self)

 

Update the current job status.

Returns: None
Overrides: BaseJob.update

doCommand(self, *args, **kwargs)

 

Execute the command associated with this job via subprocess.

Returns: None
Overrides: BaseJob.doCommand

kill(self)

 

Send termination request to subprocess managed job. If job is still alive after 60s, it is forcefully killed.

_endJob(self, force=False)

 

End a subprocess, ignoring errors from processes that have already completed. Sends a "Terminate" signal by default; sends a "Kill" signal if c{force} is True.

Parameters:
  • force - Should the process be sent a "Kill" signal instead of a "Terminate" signal?