Command line options

Last update: 06 Aug 2024 [History] [Edit]

Command line options for athena with CA

ComponentAccumulator-configured athena jobs have a number of command line options useful for debugging. For these options to work, the __main__ method of the top-level configuration file has to call flags.fillFromArgs() on the configuration flags before they get locked. This is the case for all commonly used top-level configuration files, including the ones created by the transforms. Most of the options described here existed also in the old-style configuration but in a slightly different form.

Here, we assume you are working directly with athena.py using for example a transform-written runargs.RAWtoALL.py file or a smaller config file like CaloRec/CaloRecoConfig.py. In general, the options described here can be also invoked from the transform (like Reco_tf.py) using the --athenaopts= argument. Keep in mind that a transform may run more than one athena job!

Help on options and flags

Athena has a --help option that explains all command-line options as well as available flags. The basic help is simply athena --help. To see all flag categories, run athena --help flags. To see the help for a specific category use athena --help Input.

Setting individual flags from the command line

It is possible to set (overwrite) any configuration flag from the command line using a syntax like athena.py runargs.RAWtoALL.py Debug.DumpEvtStore=True. Every argument matching the keyword=value pattern will be interpreted as attempt to set a flag. Note that the keyword in this case is just the flag-name without the name of the flag-container.

Setting number of events to be processed

Syntax: athena.py --evtMax=2 runargs.RAWtoALL.py

Equivant to setting the config flag Exec.MaxEvents

Skipping a number of events at the beginning of the input file

Syntax athena.py --skipEvents=3 runargs.RAWtoALL.py

Equivant to setting the configuration flag Exec.SkipEvents

Setting the input file(s)

Syntax: athena.py --filesInput <file1>,<file2>

Wildcards are supported. Equivant to setting the configuration flag Input.Files

Setting the log output level

Syntax: athena.py --loglevel=<level> runargs.RAWtoALL.py

Possible log-levels are (as always in athena): “ALL”,”VERBOSE”,”DEBUG”,”INFO”,”WARNING”,”ERROR” or “FATAL”

Syntax: athena.py --perfmon=<type> runargs.RAWtoALL.py

Activate performance monitoring. Possible types are fastmon or fullmon.

--threads=<n> Set the number of worker threads. 0 means running with the old (serial) event-loop manager. --concurrent-events=<n> Set the number of events processed concurrently. By default equal to the number of threads. --nproc=<n> Set the number of concurrent processes (for AthenaMP)

Store the config in a pickle file

The ComponentAccumulator object holding the final configuration can be stored in a python pickle file and later executed from there. This is useful when running with valgrind or in a profiler without profiling the python configuration stage, or in general to run the same job over and over gain without re-ding the configuration step. Storing: athena.py --config-only=myConfig.pkl

Running: athena.py myConfig.pkl

The ComponentAccumulator instance stored in the pickle behaves in the same way as one returned by a configuration-method. One can merge it with other ComponentAccumulator instances, modify properties and call run() on it.

Attaching the debugger

Syntax: athena.py --debug=<stage> runargs.RAWtoALL.py

With this option, the dbg debugger will be attached to the job just before entering <stage>. Possible stages are init, exec and fini.

Tracing the configuration step

Syntax: athena.py --tracelevel=<level>

The python code executed during the configuration step can be traced (printed) as it is executed. This feature is based on python’s trace module. There are three pre-defined levels to exclude tracing of core-modules that would otherwise flood the output:

  • level 0: Trace everything
  • level 1: Exclude system and ROOT modules
  • level 2: Exclude also the internals of GaudiConfig2
  • level 3 (default): Exclude also the internals of ComponentAccumulator

Invoking the python profiler

Syntax: athena.py --profile-python=pprof.[txt,pkl] runargs.RAWtoALL.py

This option is based on python’s cProfile module and either writes a text or pickle file with the profiling information.

Interactive athena

Syntax: athena --interactive=<stage> runargs.RAWtoALL.py

There are two fundamentally different types of interactive athena. The first one (stage “init” allows to inspect (and modify) the ComponentAccumulator instance just before execution starts. The second type (stage “run”) is an interactive prompt inside the event loop. This allow to execute one event and inspect for example the transient event store. This functionality is rather fragile and considered expert level.