TEMERITY

us.temerity.pipeline.plugin.PythonAction.v2_2_1
Class PythonAction

java.lang.Object
  extended by us.temerity.pipeline.Named
      extended by us.temerity.pipeline.PluginID
          extended by us.temerity.pipeline.BasePlugin
              extended by us.temerity.pipeline.BaseAction
                  extended by us.temerity.pipeline.plugin.CommonActionUtils
                      extended by us.temerity.pipeline.plugin.PythonActionUtils
                          extended by us.temerity.pipeline.plugin.PythonAction.v2_2_1.PythonAction
All Implemented Interfaces:
Serializable, Cloneable, Comparable<PluginID>, Glueable

public class PythonAction
extends PythonActionUtils

Executes a Python script.

This action provides some specialized features to support executing Python scripts within the Pipeline framework. The supplied Python script need not be executable since this action must work on all operating systems. Although Python scripts could be used with the Script action, this plugin is usually preferable since it is much more convienient and provides controls over how the Python interpreter is invoked. It is also possible to write Python scripts using the "os" module which are truely platform independent.

This action defines the following single valued parameters:

Script
The source node who's primary file sequence is a single Python script.

Interpreter
Which python interpreter to use to execute the script.

Optimization
The level of compiler optimizations applied.

Module Info
The verbosity of information printed about the modules loaded.

Extra Options
Additional command-line arguments.

The supplied Python script can import a dynamically created module written by this Action into the job's temporary directory called "plprep". This module defines some data structures containing a Python representation of the information passed to the prep method. This provides a convenient way of accessing this information within your Python scripts. The "plprep" module provides the following data structures:

 
 ActionAgenda = { 'JobID'  : jobid-number,
                  'NodeID' : { 'Author' : 'user-name',
                               'View'   : 'working-area',
                               'Name'   : '/full-path/node-name' },
                  'PrimaryTarget'    : [ 'file1', 'file2', ... ],
                  'SecondaryTargets' : [ [ 'file1', 'file2', ... ],
                                         [ 'file1', 'file2', ... ], ... ], 
                  'PrimarySources' : 
                    { '/full-path/source-node-name1' : [ 'file1', 'file2', ... ],
                      ... }, 
                  'SecondarySources' : 
                      { '/full-path/source-node-name1' : [ [ 'file1', 'file2', ... ],
                                                                       [ 'file1', 'file2', ... ], ... ], 
                      ... },
                  'Toolset' : '070209' }

 ScriptSource = '/full-path/script-node-name'
 
 OutFile = '/usr/tmp/pljobmgr/jobid-number/stdout'
 ErrFile = '/usr/tmp/pljobmgr/jobid-number/stderr'
 
On Windows, the STDOUT/STDERR file paths are written using the Path class instead of File to avoid issues with backslashes. A typical definition on Windows would look like:
 OutFile = 'C:/WINDOWS/Temp/pljobmgr/jobid-number/stdout'
 ErrFile = 'C:/WINDOWS/Temp/pljobmgr/jobid-number/stderr'
 

By default, the "python" program is used as the interpretor. An alternative program can be specified by setting PYTHON_BINARY in the Toolset environment to the name of the Python interpertor this Action should use. On Windows, the name of the Python interpretor should include the ".exe" extension.

See Also:
Serialized Form

Field Summary
static String aModuleInfo
           
static String aOptimization
           
static String aScript
           
 
Fields inherited from class us.temerity.pipeline.plugin.CommonActionUtils
aExtraOptions
 
Fields inherited from class us.temerity.pipeline.BasePlugin
pDescription
 
Fields inherited from class us.temerity.pipeline.PluginID
pVendor, pVersionID
 
Fields inherited from class us.temerity.pipeline.Named
pName
 
Constructor Summary
PythonAction()
           
 
Method Summary
 SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile)
          Construct a SubProcessHeavy instance which when executed will fulfill the given action agenda.
 
Methods inherited from class us.temerity.pipeline.plugin.PythonActionUtils
createPythonSubProcess, createPythonSubProcess, createPythonSubProcess, getPythonFileVerify, getPythonFileVerify, getPythonFileVerify, getPythonFileVerify, getPythonFileVerify, getPythonFileVerify, getPythonIndent, getPythonLaunchHeader, getPythonLaunchPipeHeader, getPythonProgram, getPythonProgram
 
Methods inherited from class us.temerity.pipeline.plugin.CommonActionUtils
addExtraOptionsParam, addExtraOptionsParamToLayout, createScriptSubProcess, createSubProcess, createSubProcess, createSubProcess, createSubProcess, createTempCopySubProcess, createTempScript, escPath, escPath, getExtraOptionsArgs, getPrimarySourcePath, getPrimarySourcePath, getPrimarySourcePath, getPrimarySourcePaths, getPrimarySourcePaths, getPrimarySourcePaths, getPrimaryTargetPath, getPrimaryTargetPath, getPrimaryTargetPath, getPrimaryTargetPaths, getPrimaryTargetPaths, getPrimaryTargetPaths, getSecondarySourceBooleanParamValue, getSecondarySourceDoubleParamValue, getSecondarySourceDoubleParamValue, getSecondarySourceEnumParamIndex, getSecondarySourceIntegerParamValue, getSecondarySourceIntegerParamValue, getSecondarySourceLongParamValue, getSecondarySourceLongParamValue, getSecondarySourceOptionalBooleanParamValue, getSecondarySourceStringParamValue, getSecondarySourceStringParamValue, getSingleBooleanParamValue, getSingleDoubleParamValue, getSingleDoubleParamValue, getSingleEnumParamIndex, getSingleIntegerParamValue, getSingleIntegerParamValue, getSingleLongParamValue, getSingleLongParamValue, getSingleOptionalBooleanParamValue, getSingleStringParamValue, getSingleStringParamValue, getSingleTuple2dParamValue, getSingleTuple2dParamValue, getSingleTuple2dParamValue, getSingleTuple2iParamValue, getSingleTuple2iParamValue, getSingleTuple2iParamValue, getSingleTuple3dParamValue, getSingleTuple3dParamValue, getSingleTuple3dParamValue, getSingleTuple3iParamValue, getSingleTuple3iParamValue, getSingleTuple3iParamValue, getSingleTuple4dParamValue, getSingleTuple4dParamValue, getSingleTuple4dParamValue, getSourceBooleanParamValue, getSourceDoubleParamValue, getSourceDoubleParamValue, getSourceEnumParamIndex, getSourceIntegerParamValue, getSourceIntegerParamValue, getSourceLongParamValue, getSourceLongParamValue, getSourceOptionalBooleanParamValue, getSourceStringParamValue, getSourceStringParamValue, getWorkingNodeFilePath, getWorkingNodeFilePath, getWorkingNodeFilePath, getWorkingNodeFilePath, getWorkingNodeFilePaths
 
Methods inherited from class us.temerity.pipeline.BaseAction
addPreset, addPresetValues, addSingleParam, chmod, cleanupLater, clearAllLinkParams, clearLinkParams, clone, createTemp, createTemp, equals, equalSingleParams, equalSourceParams, fromGlue, getInitialSourceParams, getPluginType, getPresetChoices, getPresetValues, getSecondarySequences, getSecondarySourceNames, getSecondarySourceParam, getSecondarySourceParams, getSecondarySourceParamValue, getSingleLayout, getSingleParam, getSingleParams, getSingleParamValue, getSourceLayout, getSourceNames, getSourceParam, getSourceParams, getSourceParamValue, getTempDir, getTempPath, hasSecondarySourceParams, hasSingleParams, hasSourceParams, initSecondarySourceParams, initSourceParams, removeAllSourceParams, removeSecondarySourceParams, removeSecondarySourceParams, removeSourceParams, setSecondarySourceParamValue, setSingleLayout, setSingleParamValue, setSingleParamValues, setSourceLayout, setSourceParamValue, setSourceParamValues, supportsSourceParams, toGlue
 
Methods inherited from class us.temerity.pipeline.BasePlugin
addSupport, compareTo, getDescription, getFullMessage, getPluginID, getResource, getResources, getResourceSize, getSupports, isUnderDevelopment, removeSupport, setSupports, supports, toString, underDevelopment
 
Methods inherited from class us.temerity.pipeline.PluginID
getVendor, getVersionID
 
Methods inherited from class us.temerity.pipeline.Named
getName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

aOptimization

public static final String aOptimization
See Also:
Constant Field Values

aScript

public static final String aScript
See Also:
Constant Field Values

aModuleInfo

public static final String aModuleInfo
See Also:
Constant Field Values
Constructor Detail

PythonAction

public PythonAction()
Method Detail

prep

public SubProcessHeavy prep(ActionAgenda agenda,
                            File outFile,
                            File errFile)
                     throws PipelineException
Construct a SubProcessHeavy instance which when executed will fulfill the given action agenda.

Overrides:
prep in class BaseAction
Parameters:
agenda - The agenda to be accomplished by the action.
outFile - The file to which all STDOUT output is redirected.
errFile - The file to which all STDERR output is redirected.
Returns:
The SubProcess which will fulfill the agenda.
Throws:
PipelineException - If unable to prepare a SubProcess due to illegal, missing or imcompatable information in the action agenda or a general failure of the prep method code.

TEMERITY