Python API: sam v8_1_5
sam.runProject()

Just having some fun...
This is the python interface to the command 'sam run project'.
Command Description:

Your "run project" script is a python script.  It should look very similar
to the sample project available at http://d0db.fnal.gov/sam/doc/userdocs/project_setup.py.

Within your project script, you _must_ define a file_ready(inputFileName)
routine, in which your main processing is performed.

You may also define the following routines:
   begin_project():  things that should be done before any files are delivered
   end_project():    things that should be done after all files have been delivered
   abort_project():  things that should be done if the project aborts abnormally

Within your script, you have access to the following routines:
   getProjectName():        returns the current project name (string)
   getConsumerId():         returns the current consumer ID from the sam db (int)
   getConsumerProcessId():  returns the current consumer process ID from the sam db (int)
   dumpProject():           does a "sam dump project" on the current project
   dumpConsumer():          does a "sam dump consumer" on the current consumer


Python Usage:
	from Sam import sam
	result = sam.runProject(...)

Return value: <none>

Arguments are passed as keyword-value pairs, as in:
	 myfunc(arg1='myarg', arg2='anotherarg', d=1)

Argument Keyword Description:
	(*) indicates that this keyword is required
	>>> indicates that either the API object or the CLI equivalent (<<<) is required
====================================================================================================================================
    KEYWORD                    DATA TYPE            DESCRIPTION
------------------------------------------------------------------------------------------------------------------------------------
(*) args                       SamBoolean           name of the userInputFile containing the processing code
    batchSystem                string               name of the batch system to use if not the station default
    batchSystemFlags           string               additional batch-specific flags to be passed to the batch system
    bundleFiles                string               comma separated list of files to send with the job to a remote batch system
    c                          SamBoolean           automatically close all servants after each method call
    corbaCallTimeout           int                  time in seconds for CORBA method calls to return before timing out (default: 0; zero implies no timeout)
    cpuPerEvent                TimeInterval         estimated amount of CPU required per event
    d                          SamBoolean           debug mode
    defname                    SamBoolean           project definition name
    envVar                     string               user environmental variables to be set when the job executes
    interactive                SamBoolean           do NOT submit the job; instead, run interactively
    jdf                        string               job description file
    jobErrorFile               string               job error file (use __default__ for the defaul error file)
    jobInfoFile                string               job information file
    jobOutputFile              string               job output file (use __default__ for the default output file)
    keepBatchScript            SamBoolean           do not remove temporary batch wrapper script after execution
    nconsumers                 int                  number of consumer processes to run in this job
    project                    string               name of the project
    queue                      string               batch queue to which the job should be submitted
    retryInterval              int                  retry interval base in seconds; will multiply this base times retryCount (default: 5)
    retryJitter                int                  retry jitter, random jitter added to base retry interval times retryCount (default: 5)
    retryMaxCount              int                  number of times to retry CORBA calls for retriable exceptions (default: 25; zero implies no retries)
    s                          SamBoolean           retrySilently mode (do not issue messages to stderr on proxy retries)
    script                     string               script containing the processing commands you wish to execute
    scriptParams               string               parameters to be passed to the script
    snapshot                   SamBoolean           name of the already-existing snapshot to be used as the project file list
    submitInfoFile             string               file into which submission information is written
    t                          SamBoolean           time-it mode (print additional info on timings)
    useForcedStop              SamBoolean           project will be stopped if job count reaches zero, regardless of whether all consumers are finished or not
    v                          SamBoolean           verbose mode
    workDir                    string               working directory for process
    wrapperScriptDir           string               directory in which to write the batch wrapper script (default: $HOME)
====================================================================================================================================

Mutually exclusive keywords:	
	(defname || snapshot) 

Environment Defaults:
	c = os.environ['SAM_PYAPI_AUTO_CLOSE_SERVANTS']
	corbaCallTimeout = os.environ['SAM_PYAPI_CORBA_CALL_TIMEOUT']
	project = os.environ['SAM_PROJECT']
	retryInterval = os.environ['SAM_PYAPI_RETRY_INTERVAL']
	retryJitter = os.environ['SAM_PYAPI_RETRY_JITTER']
	retryMaxCount = os.environ['SAM_PYAPI_RETRY_MAX_COUNT']
	s = os.environ['SAM_PYAPI_RETRY_SILENTLY']



See Also: