Configuring Jobs

From Daya Bay
Jump to navigation Jump to search
Offline Documentation: [Offline Category] [FAQ] [Howto] [Reference] [Manual]

Offline Documentation
This article is part
of the Offline Documentation
Other pages...

Offline Category
How Tos
Getting Started
Software Installation

See also...

General Help on this Wiki

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.

Using Gaudi

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 It provides commonly needed options and can run your "Job Option Modules". See the 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: -m MyModule

Modules can take their own command line arguments, in which case be sure to place things in quotes: -m 'MyModule [options] [arguments]' ...

See the Job Option Module topic for details.

Using GaudiAlgo

Using this approach, 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:

% -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 ('') and called using the python 'import' function.

In file:

class Configure()
    def __init__():
         "Set up complicated configuration here"

In file:

import YourAlgConfiguration
def configure():
     "Call your helper class to set configuration"
     myConfigure = YourAlgConfiguration.Configure()

Then you can run it:

% -n 100 YourModule
Offline Software Documentation: [Offline Categories] [FAQ] [Offline Manual Category]