Belle II Software light-2406-ragdoll
|
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. | |
const std::string & | getExternalsPath () const |
Returns the path which points to the externals directory of the framework. | |
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. | |
std::vector< std::string > | getEntrySequencesOverride () const |
Returns the number sequences (e.g. | |
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? | |
void | setRunType (Const::ERunType runType) |
Set the run type (beam or cosmic). | |
Const::ERunType | getRunType () const |
Get the run type (beam or cosmic) | |
bool | isCosmicRun () const |
Is the run for cosmics data? | |
bool | isBeamRun () const |
Is the run for beam 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. | |
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. | |
void | setNumberProcesses (int number) |
Sets the number of processes which should be used for the parallel processing. | |
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. | |
std::string | getPicklePath () const |
Returns the path to the file where the pickled path is stored. | |
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. | |
bool | getDryRun () const |
Read steering file, but do not start any actually start any event processing. | |
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 | setWriteSimSteps (const bool writeSimSteps) |
Set the flag for writing the simulation steps into an output csv file. | |
bool | getWriteSimSteps () const |
Get the flag for writing the simulation steps into an output csv file. | |
void | printJobInformation () const |
Print information on input/output files in current steering file, used by –dry-run. | |
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. | |
Private Member Functions | |
Environment () | |
Set up environment from standard BELLE2_ environment variables. | |
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. | |
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. | |
bool | m_dryRun |
Read steering file, but do not start any actually start any event processing. | |
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. | |
Const::ERunType | m_runType = Const::c_Beam |
Flag which tells if the run is beam (default: c_Beam) or cosmic (c_Cosmic). | |
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_writeSimSteps |
bool for writing out the simulation steps into a csv file. | |
bool | m_useZMQ = false |
Set to true to use ZMQ instead of RingBuffer. | |
std::string | m_zmqSocketAddress = "" |
Socket address to use in ZMQ. | |
unsigned int | m_zmqMaximalWaitingTime |
Maximal waiting time of any ZMQ module for any communication in ms. | |
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. | |
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. | |
bool | m_zmqDAQEnvironment = false |
True in DAQ environment. | |
int | m_zmqDAQFirstEventExp = 42 |
Exp no. | |
int | m_zmqDAQFirstEventRun = 8 |
Exp no. | |
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 33 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 203 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 73 of file Environment.h.
|
inline |
|
inline |
Returns the path which points to the externals directory of the framework.
Definition at line 61 of file Environment.h.
|
inline |
Return overriden input file names, or empty vector if none were set.
Definition at line 115 of file Environment.h.
|
inline |
const list< string > & getModuleSearchPaths | ( | ) | const |
Returns a list of file paths searched for module libraries.
Definition at line 34 of file Environment.cc.
|
inline |
Disable collection of statistics during event processing.
Definition at line 199 of file Environment.h.
|
inline |
Returns number of events in run 1 for EventInfoSetter module, or 0 for no override.
Definition at line 67 of file Environment.h.
unsigned int getNumberOfEvents | ( | ) | const |
Return the number of events, from either input or EventInfoSetter, or -n command line override (if less).
Definition at line 39 of file Environment.cc.
|
inline |
|
inline |
Returns the number of worker processes which should be used for the parallel processing.
Definition at line 157 of file Environment.h.
|
inline |
Return overriden output file name, or "" if none was set.
Definition at line 127 of file Environment.h.
|
inline |
Return the name of the module which consumed the OutputFileOverride, "" if no output file override was set or no other module consumed it.
Definition at line 138 of file Environment.h.
|
inline |
Returns the path to the file where the pickled path is stored.
Definition at line 177 of file Environment.h.
|
inline |
Return the name of the module to be profiled, empty if no profiling was requested.
Definition at line 232 of file Environment.h.
|
inline |
Get the basf2 execution realm.
Definition at line 211 of file Environment.h.
|
inline |
|
inline |
|
inline |
Return overriden secondary input file names, or empty vector if none were set.
Definition at line 121 of file Environment.h.
|
inline |
|
inline |
|
inline |
Get list of streaming objects.
Definition at line 244 of file Environment.h.
|
inline |
Flag if ZMQ should be used instead of the RingBuffer multiprocesing implementation.
Definition at line 248 of file Environment.h.
|
inline |
Wether to generate DOT files with data store inputs/outputs of each module.
Definition at line 193 of file Environment.h.
|
inline |
Get the flag for writing the simulation steps into an output csv file.
Definition at line 219 of file Environment.h.
|
inline |
obtain current environment (DAQ or not)
Definition at line 345 of file Environment.h.
|
inline |
get the exp number for DAQ first event
Definition at line 357 of file Environment.h.
|
inline |
get run number for DAQ first event
Definition at line 369 of file Environment.h.
|
inline |
Number of events to keep in flight for every worker.
Definition at line 284 of file Environment.h.
|
inline |
If a worker dies, fail also.
Definition at line 332 of file Environment.h.
|
inline |
Maximal waiting time of any ZMQ module for any communication in ms.
Definition at line 272 of file Environment.h.
|
inline |
If a worker dies, restart it.
Definition at line 320 of file Environment.h.
|
inline |
Socket address to use in ZMQ.
Definition at line 260 of file Environment.h.
|
inline |
If a worker dies, store its events in a backup.
Definition at line 308 of file Environment.h.
|
inline |
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 296 of file Environment.h.
|
static |
Static method to get a reference to the Environment instance.
Definition at line 28 of file Environment.cc.
|
inline |
|
inline |
bool isMC | ( | ) | const |
Do we have generated, not real data?
Definition at line 54 of file Environment.cc.
|
inline |
checks the exp/run is DAQ first event
Definition at line 381 of file Environment.h.
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 181 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 201 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 70 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 54 of file Environment.h.
|
inline |
Override input file names for modules.
Definition at line 112 of file Environment.h.
void setJobInformation | ( | const std::shared_ptr< Path > & | path | ) |
Set info from path executed by the framework.
Definition at line 161 of file Environment.cc.
|
inline |
Override global log level if != LogConfig::c_Default.
Definition at line 235 of file Environment.h.
|
inline |
Disable collection of statistics during event processing.
Definition at line 196 of file Environment.h.
|
inline |
Override the number of events in run 1 for EventInfoSetter module.
Definition at line 64 of file Environment.h.
|
inline |
Set number of generated events (for EventInfoSetter).
Definition at line 109 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 152 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 144 of file Environment.h.
|
inline |
Override output file name for modules.
Definition at line 124 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 170 of file Environment.h.
|
inline |
Set the name of a module to be profiled.
Definition at line 229 of file Environment.h.
void setRealm | ( | LogConfig::ELogRealm | realm | ) |
Set the basf2 execution realm.
Definition at line 61 of file Environment.cc.
|
inline |
|
inline |
Set the run type (beam or cosmic).
Definition at line 95 of file Environment.h.
|
inline |
Override secondary input file names for modules.
Definition at line 118 of file Environment.h.
|
inline |
Set skipNEvents override.
Definition at line 87 of file Environment.h.
|
inline |
Sets the steering file content.
Definition at line 182 of file Environment.h.
|
inline |
Set list of streaming objects.
Definition at line 241 of file Environment.h.
|
inline |
Set the flag if ZMQ should be used instead of the RingBuffer multiprocessing implementation.
Definition at line 254 of file Environment.h.
|
inline |
Wether to generate DOT files with data store inputs/outputs of each module.
Definition at line 190 of file Environment.h.
|
inline |
Set the flag for writing the simulation steps into an output csv file.
This is useful for simulating events for the Belle II Virtual Reality application.
Definition at line 217 of file Environment.h.
|
inline |
Set DAQ environment.
Definition at line 351 of file Environment.h.
|
inline |
set the exp number for DAQ first event
Definition at line 363 of file Environment.h.
|
inline |
set run number for DAQ first event
Definition at line 375 of file Environment.h.
|
inline |
Number of events to keep in flight for every worker.
Definition at line 290 of file Environment.h.
|
inline |
If a worker dies, fail also.
Definition at line 338 of file Environment.h.
|
inline |
Maximal waiting time of any ZMQ module for any communication in ms.
Definition at line 278 of file Environment.h.
|
inline |
If a worker dies, restart it.
Definition at line 326 of file Environment.h.
|
inline |
Socket address to use in ZMQ.
Definition at line 266 of file Environment.h.
|
inline |
If a worker dies, store its events in a backup.
Definition at line 314 of file Environment.h.
|
inline |
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 302 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 405 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 398 of file Environment.h.
|
private |
override experiment for EventInfoSetter.
Definition at line 412 of file Environment.h.
|
private |
The path in which the externals are located.
Definition at line 391 of file Environment.h.
|
private |
Override input file names for input modules.
Definition at line 395 of file Environment.h.
|
private |
Output for printJobInformation(), generated by setJobInformation().
Definition at line 406 of file Environment.h.
|
private |
Override global log level if != LogConfig::c_Default.
Definition at line 402 of file Environment.h.
|
private |
counter for number of generated events.
Definition at line 410 of file Environment.h.
|
private |
Disable collection of statistics during event processing.
Useful for very high-rate applications.
Definition at line 404 of file Environment.h.
|
private |
Override number of events in the first run.
Definition at line 394 of file Environment.h.
|
private |
The number of worker processes that should be used for the parallel processing.
Definition at line 392 of file Environment.h.
|
private |
Override m_numberProcesses if >= 0.
Definition at line 401 of file Environment.h.
|
private |
Override name of output file for output module.
Definition at line 399 of file Environment.h.
|
private |
Name of the module which consumed the output file Override if any was given.
Definition at line 400 of file Environment.h.
|
private |
Path to the file where the pickled path is stored.
Definition at line 408 of file Environment.h.
|
private |
Name of the module which should be profiled, empty if no profiling requested.
Definition at line 407 of file Environment.h.
|
private |
The realm in which basf2 is executed.
Definition at line 415 of file Environment.h.
|
private |
override run for EventInfoSetter.
Definition at line 411 of file Environment.h.
|
private |
Flag which tells if the run is beam (default: c_Beam) or cosmic (c_Cosmic).
Definition at line 413 of file Environment.h.
|
private |
Override secondary input file names for input modules.
Definition at line 396 of file Environment.h.
|
private |
override skipNEvents for EventInfoSetter/RootInput.
Definition at line 414 of file Environment.h.
|
private |
The content of the steering file.
Definition at line 393 of file Environment.h.
|
private |
objects to be streamed in Tx module (all if empty)
Definition at line 409 of file Environment.h.
|
private |
Set to true to use ZMQ instead of RingBuffer.
Definition at line 419 of file Environment.h.
|
private |
Wether to generate DOT files with data store inputs/outputs of each module.
Definition at line 403 of file Environment.h.
|
private |
bool for writing out the simulation steps into a csv file.
Definition at line 416 of file Environment.h.
|
private |
True in DAQ environment.
Definition at line 429 of file Environment.h.
|
private |
|
private |
|
private |
Number of events to keep in flight for every worker.
Definition at line 423 of file Environment.h.
|
private |
If a worker dies, fail also.
Will not be used if restartFailedWorkers is true.
Definition at line 428 of file Environment.h.
|
private |
Maximal waiting time of any ZMQ module for any communication in ms.
Definition at line 421 of file Environment.h.
|
private |
If a worker dies, restart it.
Definition at line 427 of file Environment.h.
|
private |
Socket address to use in ZMQ.
If not set, uses a random IPC connection.
Definition at line 420 of file Environment.h.
|
private |
If a worker dies, store its events in a backup.
Definition at line 426 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 424 of file Environment.h.