qb :: backend :: pythonChildBackEnd :: PythonChildBackEnd :: Class PythonChildBackEnd
[hide private]
[frames] | no frames]

Class PythonChildBackEnd

source code


A python-based Qube backend that has a PyCmdDispatcher.

It will run another python interpreter of some sort (usually a 2D or 3D app) as a child process, and interact with it via the PyCmdDispatcher.

Instance Methods [hide private]
 
__init__(self, job)
Function to initialize class members.
source code
tuple ([childArgs], [pyInitCmds])
getSubprocessArgs(self, port)
Determine the arguments necessary to invoke the child process.
source code
 
generateChildBootstrapper(self, port)
This is only overridden if a 3rd-party application which will be started cannot use the standard child_bootstrapper.py script.
source code
pythonChildHandler.PyCmdDispatcher
initPyCmdDispatcher(self)
Initialize a PyCmdDispatcher instance.
source code
 
jobSetup(self)
Perform any steps necessary to initialize the working enviroment prior to beginning any agendaItem-specific steps.
source code
 
executeWork(self)
Request an agendaItem (work) from the supervisor and do any steps necessary to perform the work.
source code
 
jobTeardown(self)
Perform any steps necessary to clean up the working enviroment prior to shutting down the job instance.
source code

Inherited from pythonBackEnd.PythonQubeBackEnd: getLogData, hasJobPhaseCmds, 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]
  DEFAULT_PYTHON = '/opt/local/Library/Frameworks/Python.framewo...

Inherited from pythonBackEnd.PythonQubeBackEnd: LOGREAD_TIME_THRESHOLD, QB_WAITING_TIMEOUT

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, job)
(Constructor)

source code 

Function to initialize class members.

Parameters:
  • job - The qube job object passed to the worker, this represents a job instance.
Overrides: object.__init__

getSubprocessArgs(self, port)

source code 

Determine the arguments necessary to invoke the child process.

This is the main method that differentiates derived classes, and is probably the only method that will need to be overridden.

Parameters:
  • port (int) - the port on which the PyCmdDispatcher's backchannel instance is listening, usually passed as a parameter to the child_bootstrapper.py script which starts up the pyCmdExecutor inside child process started by the PyCmdDispatcher
Returns: tuple ([childArgs], [pyInitCmds])
Return a tuple of a list of args to start the python interpreter, and a list of python commands to initialize the python working environment.
Raises:
  • NotImplementedError - Raised when this method is not overridden in a derived class.

generateChildBootstrapper(self, port)

source code 

This is only overridden if a 3rd-party application which will be started cannot use the standard child_bootstrapper.py script. This can happen if the 3rd-party app doesn't support passing arguments to the bootstrapper.

Parameters:
  • port (int) - the port on which the PyCmdDispatcher's backchannel instance is listening, usually passed as a parameter to the child_bootstrapper.py script which starts up the pyCmdExecutor inside child process started by the PyCmdDispatcher

initPyCmdDispatcher(self)

source code 

Initialize a PyCmdDispatcher instance.

The PyCmdDispatcher is this side of the bi-directional communication with a python interpeter running in a child process. It is the mechanism to dispatch the commands to the interpreter and handle any return values or exceptions.

Returns: pythonChildHandler.PyCmdDispatcher
Return a pythonChildHandler.PyCmdDispatcher object, which will have a running python process of some sort (python, mayaPy, houdini, etc.) as a child attribute

jobSetup(self)

source code 

Perform any steps necessary to initialize the working enviroment prior to beginning any agendaItem-specific steps.

Overrides: pythonBackEnd.PythonQubeBackEnd.jobSetup

executeWork(self)

source code 

Request an agendaItem (work) from the supervisor and do any steps necessary to perform the work.

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

jobTeardown(self)

source code 

Perform any steps necessary to clean up the working enviroment prior to shutting down the job instance.

Overrides: pythonBackEnd.PythonQubeBackEnd.jobTeardown

Class Variable Details [hide private]

DEFAULT_PYTHON

Value:
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources\
/Python.app/Contents/MacOS/Python'