|Offline Documentation: [Offline Category] [FAQ] [Howto] [Reference] [Manual]|
|This article is part |
of the Offline Documentation
Note: this needs cleaning up.
Here is a quick introduction to configuring your jobs in the offline software. For a detailed presentation, see Brett's slides from the Dec08 tutorial DocDB-2941.
At the center of each job is Gaudi and you often do not "see" this center.
You interact with Gaudi through Python-based job configuration code and by writing algorithms in either Python or C++.
You then run a job through
Essentially all possible jobs are run through a single command line executable called nuwa.py. It provides commonly needed options and can run your "Job Option Modules". See the Nuwa.py topic for details.
Job Option Modules
To make a job unique you must a Job Option Module (JOM). Adding modules to a job is done like:
nuwa.py -m MyModule
Modules can take their own command line arguments, in which case be sure to place things in quotes:
nuwa.py -m 'MyModule [options] [arguments]' ...
See the Job Option Module topic for details.
Using this approach, nuwa.py plus a Module, you can only run the algorithms that are C++ and have been compiled into dybgaudi. What if you want to do a simple job, like filling histograms or making a simple calculation? Gaudi has a sneaky feature that you can define an Algorithm in python and pass it into Gaudi. This is called a GaudiAlgo. So in your Module, you can write a python class based on GaudiAlgo:
class YourNewAlg(GaudiAlgo): /// define class functions initialize(), execute(), finalize() here ///
Because of the details of Gaudi, you can only add your python algorithm just before starts 'running'. To do this, you must define a 'run(app)' function in your Module:
def run(app): Configure and add an algorithm to job yourAlg = YourNewAlg("YourNewAlg") app.addAlgorithm( yourAlg )
Then you can run the Gaudi job:
% nuwa.py -n 100 YourGaudiAlgoModule
Using Configure() classes
If you have a C++ Algorithm and the configuration is complicated, you can put all the configuration into a python class and just call the Configure() class. This class can be put in a separate file ('YourAlgConfiguration.py') and called using the python 'import' function.
In YourAlgConfiguration.py file:
class Configure() def __init__(): "Set up complicated configuration here" ... ... ...
In YourModule.py file:
import YourAlgConfiguration def configure(): "Call your helper class to set configuration" myConfigure = YourAlgConfiguration.Configure()
Then you can run it:
% nuwa.py -n 100 YourModule
|Offline Software Documentation: [Offline Categories] [FAQ] [Offline Manual Category]|