Belle II Software
release-08-01-10
|
This class stores all environment information required to run the framework, such as module or data filepaths, number of processes to be used in parallel processing etc. More...
#include <Environment.h>
Public Member Functions | |
const std::list< std::string > & | getModuleSearchPaths () const |
Returns a list of file paths searched for module libraries. | |
void | setExternalsPath (const std::string &externalsPath) |
Sets the path which points to the externals directory of the framework. More... | |
const std::string & | getExternalsPath () const |
Returns the path which points to the externals directory of the framework. More... | |
void | setNumberEventsOverride (unsigned int nevents) |
Override the number of events in run 1 for EventInfoSetter module. | |
unsigned int | getNumberEventsOverride () const |
Returns number of events in run 1 for EventInfoSetter module, or 0 for no override. | |
void | setEntrySequencesOverride (const std::vector< std::string > &sequences) |
Override the number sequences (e.g. More... | |
std::vector< std::string > | getEntrySequencesOverride () const |
Returns the number sequences (e.g. More... | |
unsigned int | getNumberOfEvents () const |
Return the number of events, from either input or EventInfoSetter, or -n command line override (if less). | |
void | setRunExperimentOverride (int run, int experiment) |
Override run and experiment for EventInfoSetter. | |
int | getRunOverride () const |
Get run override, or -1 if unset. | |
int | getExperimentOverride () const |
Get experiment override, or -1 if unset. | |
void | setSkipEventsOverride (unsigned int skipEvents) |
Set skipNEvents override. | |
unsigned int | getSkipEventsOverride () const |
Get skipNEvents override, or 0 if unset. | |
bool | isMC () const |
Do we have generated, not real data? | |
unsigned int | getNumberOfMCEvents () const |
Number of generated events (from EventInfoSetter). | |
void | setNumberOfMCEvents (unsigned int n) |
Set number of generated events (for EventInfoSetter). | |
void | setInputFilesOverride (const std::vector< std::string > &names) |
Override input file names for modules. | |
const std::vector< std::string > & | getInputFilesOverride () const |
Return overriden input file names, or empty vector if none were set. | |
void | setSecondaryInputFilesOverride (const std::vector< std::string > &names) |
Override secondary input file names for modules. | |
const std::vector< std::string > & | getSecondaryInputFilesOverride () const |
Return overriden secondary input file names, or empty vector if none were set. | |
void | setOutputFileOverride (const std::string &name) |
Override output file name for modules. | |
const std::string & | getOutputFileOverride () const |
Return overriden output file name, or "" if none was set. | |
std::string | consumeOutputFileOverride (const std::string &moduleName) |
Return overriden output file name, or "" if none was set. More... | |
const std::string & | getOutputFileOverrideModule () const |
Return the name of the module which consumed the OutputFileOverride, "" if no output file override was set or no other module consumed it. | |
void | setNumberProcessesOverride (int nproc) |
Override number of processes to run in parallel. More... | |
void | setNumberProcesses (int number) |
Sets the number of processes which should be used for the parallel processing. More... | |
int | getNumberProcesses () const |
Returns the number of worker processes which should be used for the parallel processing. | |
void | setPicklePath (const std::string &path) |
Sets the path to the file where the pickled path is stored. More... | |
std::string | getPicklePath () const |
Returns the path to the file where the pickled path is stored. More... | |
void | setSteering (const std::string &steering) |
Sets the steering file content. | |
const std::string & | getSteering () const |
Returns the steering file content. | |
void | setVisualizeDataFlow (bool on) |
Wether to generate DOT files with data store inputs/outputs of each module. | |
bool | getVisualizeDataFlow () const |
Wether to generate DOT files with data store inputs/outputs of each module. | |
void | setNoStats (bool noStats) |
Disable collection of statistics during event processing. | |
bool | getNoStats () const |
Disable collection of statistics during event processing. | |
void | setDryRun (bool dryRun) |
Read steering file, but do not start any actually start any event processing. More... | |
bool | getDryRun () const |
Read steering file, but do not start any actually start any event processing. More... | |
void | setJobInformation (const std::shared_ptr< Path > &path) |
Set info from path executed by the framework. | |
void | setRealm (LogConfig::ELogRealm realm) |
Set the basf2 execution realm. | |
LogConfig::ELogRealm | getRealm () const |
Get the basf2 execution realm. | |
void | printJobInformation () const |
Print information on input/output files in current steering file, used by –dry-run. More... | |
void | setProfileModuleName (const std::string &name) |
Set the name of a module to be profiled. | |
std::string | getProfileModuleName () const |
Return the name of the module to be profiled, empty if no profiling was requested. | |
void | setLogLevelOverride (int level) |
Override global log level if != LogConfig::c_Default. | |
int | getLogLevelOverride () const |
Get log level override. | |
void | setStreamingObjects (const std::vector< std::string > &strobjs) |
Set list of streaming objects. | |
const std::vector< std::string > & | getStreamingObjects () const |
Get list of streaming objects. | |
bool | getUseZMQ () const |
Flag if ZMQ should be used instead of the RingBuffer multiprocesing implementation. | |
void | setUseZMQ (bool useZMQ) |
Set the flag if ZMQ should be used instead of the RingBuffer multiprocessing implementation. | |
const std::string & | getZMQSocketAddress () const |
Socket address to use in ZMQ. | |
void | setZMQSocketAddress (const std::string &zmqSocketAddress) |
Socket address to use in ZMQ. | |
unsigned int | getZMQMaximalWaitingTime () const |
Maximal waiting time of any ZMQ module for any communication in ms. | |
void | setZMQMaximalWaitingTime (unsigned int zmqMaximalWaitingTime) |
Maximal waiting time of any ZMQ module for any communication in ms. | |
unsigned int | getZMQEventBufferSize () const |
Number of events to keep in flight for every worker. | |
void | setZMQEventBufferSize (unsigned int zmqEventBufferSize) |
Number of events to keep in flight for every worker. | |
unsigned int | getZMQWorkerTimeout () const |
How long should a worker maximally need to process all of his events in the queue. Set to 0 to disable the check. | |
void | setZMQWorkerTimeout (unsigned int zmqWorkerTimeout) |
How long should a worker maximally need to process all of his events in the queue. Set to 0 to disable the check. | |
bool | getZMQUseEventBackup () const |
If a worker dies, store its events in a backup. | |
void | setZMQUseEventBackup (bool zmqUseEventBackup) |
If a worker dies, store its events in a backup. | |
bool | getZMQRestartFailedWorkers () const |
If a worker dies, restart it. | |
void | setZMQRestartFailedWorkers (bool zmqRestartFailedWorkers) |
If a worker dies, restart it. | |
bool | getZMQFailOnFailedWorkers () const |
If a worker dies, fail also. | |
void | setZMQFailOnFailedWorkers (bool zmqFailOnFailedWorkers) |
If a worker dies, fail also. | |
bool | getZMQDAQEnvironment () const |
obtain current environment (DAQ or not) | |
void | setZMQDAQEnvironment (bool zmqDAQ) |
Set DAQ environment. | |
int | getZMQDAQFirstEventExp () const |
get the exp number for DAQ first event | |
void | setZMQDAQFirstEventExp (int exp) |
set the exp number for DAQ first event | |
int | getZMQDAQFirstEventRun () const |
get run number for DAQ first event | |
void | setZMQDAQFirstEventRun (int run) |
set run number for DAQ first event | |
bool | isZMQDAQFirstEvent (int exp, int run) |
checks the exp/run is DAQ first event | |
Static Public Member Functions | |
static Environment & | Instance () |
Static method to get a reference to the Environment instance. More... | |
Private Member Functions | |
Environment () | |
Set up environment from standard BELLE2_ environment variables. More... | |
Environment (const Environment &)=delete | |
Disable/Hide the copy constructor. | |
Environment & | operator= (const Environment &)=delete |
Disable/Hide the copy assignment operator. | |
~Environment () | |
The Environment destructor. | |
Private Attributes | |
std::string | m_externalsPath |
The path in which the externals are located. | |
int | m_numberProcesses |
The number of worker processes that should be used for the parallel processing. | |
std::string | m_steering |
The content of the steering file. | |
unsigned int | m_numberEventsOverride |
Override number of events in the first run. | |
std::vector< std::string > | m_inputFilesOverride |
Override input file names for input modules. | |
std::vector< std::string > | m_secondaryInputFilesOverride |
Override secondary input file names for input modules. | |
std::vector< std::string > | m_entrySequencesOverride |
A number sequence (e.g. More... | |
std::string | m_outputFileOverride |
Override name of output file for output module. | |
std::string | m_outputFileOverrideModule {""} |
Name of the module which consumed the output file Override if any was given. | |
int | m_numberProcessesOverride |
Override m_numberProcesses if >= 0. | |
int | m_logLevelOverride |
Override global log level if != LogConfig::c_Default. | |
bool | m_visualizeDataFlow |
Wether to generate DOT files with data store inputs/outputs of each module. | |
bool | m_noStats |
Disable collection of statistics during event processing. More... | |
bool | m_dryRun |
Read steering file, but do not start any actually start any event processing. More... | |
std::string | m_jobInfoOutput |
Output for printJobInformation(), generated by setJobInformation(). | |
std::string | m_profileModuleName |
Name of the module which should be profiled, empty if no profiling requested. | |
std::string | m_picklePath |
Path to the file where the pickled path is stored. | |
std::vector< std::string > | m_streamingObjects |
objects to be streamed in Tx module (all if empty) | |
unsigned int | m_mcEvents |
counter for number of generated events. | |
int | m_run |
override run for EventInfoSetter. | |
int | m_experiment |
override experiment for EventInfoSetter. | |
unsigned int | m_skipNEvents |
override skipNEvents for EventInfoSetter/RootInput. | |
LogConfig::ELogRealm | m_realm = LogConfig::c_None |
The realm in which basf2 is executed. | |
bool | m_useZMQ = false |
Set to true to use ZMQ instead of RingBuffer. | |
std::string | m_zmqSocketAddress = "" |
Socket address to use in ZMQ. More... | |
unsigned int | m_zmqMaximalWaitingTime |
Maximal waiting time of any ZMQ module for any communication in ms. More... | |
unsigned int | m_zmqEventBufferSize = 1 |
Number of events to keep in flight for every worker. | |
unsigned int | m_zmqWorkerTimeout |
How long should a worker maximally need to process all of his events in the queue. More... | |
bool | m_zmqUseEventBackup = true |
If a worker dies, store its events in a backup. | |
bool | m_zmqRestartFailedWorkers = true |
If a worker dies, restart it. | |
bool | m_zmqFailOnFailedWorkers = true |
If a worker dies, fail also. More... | |
bool | m_zmqDAQEnvironment = false |
True in DAQ environment. | |
int | m_zmqDAQFirstEventExp = 42 |
Exp no. More... | |
int | m_zmqDAQFirstEventRun = 8 |
Exp no. More... | |
This class stores all environment information required to run the framework, such as module or data filepaths, number of processes to be used in parallel processing etc.
Usually, this information is set by the steering file.
This class is designed as a singleton.
Definition at line 32 of file Environment.h.
|
private |
Set up environment from standard BELLE2_ environment variables.
Ends with B2FATAL if something goes wrong.
Definition at line 85 of file Environment.cc.
std::string consumeOutputFileOverride | ( | const std::string & | moduleName | ) |
Return overriden output file name, or "" if none was set.
Note that this will remove the current value to avoid reuse. (e.g. subsequent calls will always return "")
Definition at line 67 of file Environment.cc.
|
inline |
Read steering file, but do not start any actually start any event processing.
Prints information on input/output files and number of events that that would be used during normal execution.
Definition at line 191 of file Environment.h.
|
inline |
Returns the number sequences (e.g.
23:42,101) defining the entry which are processed for each filename given in inputFilesOverride
Definition at line 72 of file Environment.h.
|
inline |
Returns the path which points to the externals directory of the framework.
Definition at line 60 of file Environment.h.
|
inline |
Returns the path to the file where the pickled path is stored.
Definition at line 165 of file Environment.h.
|
static |
Static method to get a reference to the Environment instance.
Definition at line 28 of file Environment.cc.
void printJobInformation | ( | ) | const |
Print information on input/output files in current steering file, used by –dry-run.
Function only relies on information available during module construction, but requires that Framework::process() has been called to set a path.
Definition at line 179 of file Environment.cc.
|
inline |
Read steering file, but do not start any actually start any event processing.
Prints information on input/output files and number of events that that would be used during normal execution.
Definition at line 189 of file Environment.h.
|
inline |
Override the number sequences (e.g.
23:42,101) defining the entries which are processed for each filename given in inputFilesOverride
Definition at line 69 of file Environment.h.
|
inline |
Sets the path which points to the externals directory of the framework.
externalsPath | Path in which the externals of the framework are located. |
Definition at line 53 of file Environment.h.
|
inline |
Sets the number of processes which should be used for the parallel processing.
If the value is set to 0, no parallel processing will be used in the event loop.
number | The number of processes used for the parallel processing. |
Definition at line 140 of file Environment.h.
|
inline |
Override number of processes to run in parallel.
Only values >= 0 will change the result of getNumberProcesses().
Definition at line 132 of file Environment.h.
|
inline |
Sets the path to the file where the pickled path is stored.
path | The path to the file where the pickled path is stored. |
Definition at line 158 of file Environment.h.
|
private |
Read steering file, but do not start any actually start any event processing.
Prints information on input/output files that that would be used during normal execution.
Definition at line 385 of file Environment.h.
|
private |
A number sequence (e.g.
23:42,101) defining the entries which are processed for each input file in m_inputFilesOverride.
Definition at line 378 of file Environment.h.
|
private |
Disable collection of statistics during event processing.
Useful for very high-rate applications.
Definition at line 384 of file Environment.h.
|
private |
|
private |
|
private |
If a worker dies, fail also.
Will not be used if restartFailedWorkers is true.
Definition at line 406 of file Environment.h.
|
private |
Maximal waiting time of any ZMQ module for any communication in ms.
Definition at line 399 of file Environment.h.
|
private |
Socket address to use in ZMQ.
If not set, uses a random IPC connection.
Definition at line 398 of file Environment.h.
|
private |
How long should a worker maximally need to process all of his events in the queue.
Set to 0 to disable the check.
Definition at line 402 of file Environment.h.