Package qb :: Package backend :: Module commandBackEnd :: Class CommandBackEnd
[hide private]
[frames] | no frames]

Class CommandBackEnd

source code


A base class for command-line and command range jobtypes written in Python.

The basic runtime log parsing functionality is defined here.

Instance Methods [hide private]
int
runCmd(self, work, cmd, qbTokens=None)
Determine which module we can use to run the command:
source code
int
runCmdWithSubprocess(self, work, childArgs, qbTokens=None)
Run via subprocess(), monitor child process and parse worker's job logs while the child is alive
source code
 
executeWork(self)
This method must be defined for all derived classes.
source code

Inherited from pythonBackEnd.PythonQubeBackEnd: __init__, getLogData, hasJobPhaseCmds, jobSetup, jobTeardown, logHandler, parseLogData, printClassInfo, updateResultPackage, validateOutputFileSize

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

Class Variables [hide private]

Inherited from pythonBackEnd.PythonQubeBackEnd: LOGREAD_TIME_THRESHOLD, QB_WAITING_TIMEOUT

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

runCmd(self, work, cmd, qbTokens=None)

source code 

Determine which module we can use to run the command:

* subprocess if we're on python >= 2.4 * popen2 if we're on an older python on linux

Parameters:
  • work (dict) - either a Qube job instance or an agenda item
  • cmd (str) - the cmd for the child process
  • qbTokens (dict) - a dictionary containing the various QB_FRAME* cmdrange tokens evaluated in the context of the current running work item to aid in calculating the in-chunk progress.
Returns: int
the return code of the child process' command

runCmdWithSubprocess(self, work, childArgs, qbTokens=None)

source code 

Run via subprocess(), monitor child process and parse worker's job logs while the child is alive

Log parsing is done while the child is alive, and once more after the job instance returns.

Parameters:
  • work (dict) - either a Qube job instance or an agenda item
  • childArgs (list) - the arguments for the child process, the first element is the shell
  • qbTokens (dict) - a dictionary containing the various QB_FRAME* cmdrange tokens evaluated in the context of the current running work item to aid in calculating the in-chunk progress.
Returns: int
the return code of the child process' command

executeWork(self)

source code 

This method must be defined for all derived classes.

Raises:
  • NotImplementedError - Raised when this method is not overridden in a derived class.
Overrides: pythonBackEnd.PythonQubeBackEnd.executeWork