Belle II Software light-2406-ragdoll
|
Class to enable configuration of the conditions database access in C++ and python. More...
#include <Configuration.h>
Public Member Functions | |
Configuration () | |
Initialize default values. | |
void | reset () |
Reset to default values. | |
void | setInitialized (bool value) |
Set by the Database singleton upon initialization and cleanup. | |
Configuration of globaltags | |
These members are responsible to configure the list of user globaltags which will be used in addition or instead of the base globaltags. | |
void | appendGlobalTag (const std::string &globalTag) |
Append a globaltag. | |
void | prependGlobalTag (const std::string &globalTag) |
preprend a globaltag | |
void | setGlobalTags (const std::vector< std::string > &list) |
Set the list of globaltags. | |
void | setGlobalTagsPy (const boost::python::list &globalTags) |
Set the list of globaltags from python. | |
std::vector< std::string > | getGlobalTags () |
Get the list of user globaltags. | |
boost::python::list | getGlobalTagsPy () |
Get the list of user globaltags as python version. | |
std::vector< std::string > | getDefaultGlobalTags () const |
Get the std::vector of default globaltags. | |
boost::python::tuple | getDefaultGlobalTagsPy () const |
Get the tuple of default globaltags as python version. | |
void | setInputGlobaltags (const std::vector< std::string > &inputTags) |
To be called by input modules with the tags to be added from input files. | |
void | setInputMetadata (const std::vector< FileMetaData > &inputMetadata) |
To be called by input modules with the list of all input FileMetaData. | |
std::vector< std::string > | getBaseTags () const |
Get the base globaltags to be used in addition to user globaltags. | |
void | overrideGlobalTags () |
Enable globaltag override: If this is called once than overrideEnabled() will return true and getFinalListOfTags() will just return getGlobalTags() | |
void | overrideGlobalTagsPy (const boost::python::list &globalTags) |
Enable globaltag override and set the list of user globaltags in one go. | |
bool | overrideEnabled () const |
Check if override is enabled by previous calls to overrideGlobalTags() | |
void | disableGlobalTagReplay () |
Disable global tag replay. | |
std::vector< std::string > | getFinalListOfTags () |
Get the final list of globaltags to be used for processing. | |
Testing Payload Configuration These members control where to look | |
for temporary testing payloads. Each entry in the list of locations should be a filename of a textfile containing payload information. All payload files need to be in the same directory as the text file. Entries are highest priority first: Payloads found by earlier entries will take precedence over later entries. Payloads found in these text files. take precedence over payloads from globaltags.
| |
void | appendTestingPayloadLocation (const std::string &filename) |
Add a local text file with testing payloads. | |
void | prependTestingPayloadLocation (const std::string &filename) |
Prepend a local text file with testing payloads to the list. | |
void | setTestingPayloadLocations (const std::vector< std::string > &list) |
Set the list of local text files to look for testing payloads. | |
void | setTestingPayloadLocationsPy (const boost::python::list &list) |
Set the list of text files containing test payloads in python. | |
std::vector< std::string > | getTestingPayloadLocations () |
Get the list of testing payload locations. | |
boost::python::list | getTestingPayloadLocationsPy () |
Get the list of text files containing test payloads in python. | |
Configure Metadata providers | |
These members are used to configure metadata providers: Where to look for payload information given the list of globaltags.
| |
void | appendMetadataProvider (const std::string &provider) |
Append a metadata provider to the list. | |
void | prependMetadataProvider (const std::string &provider) |
Prepend a metadata provider to the list. | |
void | setMetadataProviders (const std::vector< std::string > &list) |
Set the list of metadata providers. | |
void | setMetadataProvidersPy (const boost::python::list &list) |
Set the list of metadata providers in python. | |
std::vector< std::string > | getMetadataProviders () |
Get the list of metadata providers. | |
boost::python::list | getMetadataProvidersPy () |
Get the list of metadata providers in python. | |
std::string | getDefaultMetadataProviderUrl () |
Get the default URL where to look for the metadata provider. | |
Payload Location Configuration | |
Configure where to look for payload files. This should be a list of directories and or http(s) urls where the files containing the payload content can be found. Each location will be tried in turn and if the payload is not found in any of them we try to download it from the official server. | |
void | appendPayloadLocation (const std::string &location) |
Append a payload to the list of locations. | |
void | prependPayloadLocation (const std::string &location) |
Prepend a payload to the list of locations. | |
void | setPayloadLocations (const std::vector< std::string > &list) |
Set the list of payload locations. | |
void | setPayloadLocationsPy (const boost::python::list &list) |
Set the list of payload locations in python. | |
std::vector< std::string > | getPayloadLocations () |
Get the list of payload locations. | |
boost::python::list | getPayloadLocationsPy () |
Get the list og payload locations in python. | |
Expert Settings | |
These members are for changing some expert settings which should not be necessary for most users. These functions are exported to python using one | |
void | setNewPayloadLocation (const std::string &filename) |
Set the file where to save newly created payload information. | |
std::string | getNewPayloadLocation () const |
Get the filename where to save newly created payload information. | |
void | setDownloadCacheDirectory (const std::string &directory) |
Set the directory where to place downloaded payloads. | |
std::string | getDownloadCacheDirectory () const |
Get the directory where to place downloaded payloads. | |
void | setDownloadLockTimeout (size_t timeout) |
Set the timout we try to lock a file in the download cache directory for downloading. | |
size_t | getDownloadLockTimeout () const |
Get the timout we try to lock a file in the download cache directory for downloading. | |
void | setUsableTagStates (const std::set< std::string > &states) |
Set the set of usable globaltag states to be allowed for processing. | |
const std::set< std::string > & | getUsableTagStates () const |
Get the set of usable globaltag states allowed to be used for processing. | |
void | setGlobaltagCallbackPy (const boost::python::object &obj) |
Set a callback function from python which will be called when processing starts and should return the final list of globaltags to be used. | |
Static Public Member Functions | |
static Configuration & | getInstance () |
Get a reference to the instance which will be used when the Database is initialized. | |
static void | exposePythonAPI () |
expose this class to python | |
Private Member Functions | |
void | ensureEditable () const |
Check whether the configuration object can be edited or if the database has been initialized already. | |
Static Private Member Functions | |
template<class T > | |
static void | fillFromEnv (T &target, const std::string &envName, const std::string &defaultValue) |
Fill a target object from a list of environment variables. | |
Private Attributes | |
bool | m_overrideEnabled {false} |
is the globaltag override enabled? | |
std::optional< std::vector< std::string > > | m_inputGlobaltags |
the list of globaltags from all the input files to be used in addition to the user globaltags | |
std::vector< FileMetaData > | m_inputMetadata |
the file metadata of all input files if globaltag replay is requested by input module | |
CppOrPyList | m_globalTags |
the list with all user globaltags | |
CppOrPyList | m_testingPayloadLocations |
the files with testing payloads to use during processing | |
CppOrPyList | m_metadataProviders |
the list with all the metadata providers | |
CppOrPyList | m_payloadLocations |
the list with all the payload locations | |
std::string | m_defaultMetadataProviderUrl {"http://belle2db.sdcc.bnl.gov/b2s/rest/"} |
default URL where to look for the metadata provider | |
std::string | m_newPayloadFile {"localdb/database.txt"} |
the file to put the newly created payload information | |
std::string | m_downloadCacheDirectory {""} |
the directory to put newly downloaded payloads | |
size_t | m_downloadLockTimeout {120} |
the timeout when trying to lock files in the download directory | |
std::set< std::string > | m_usableTagStates {"TESTING", "VALIDATED", "PUBLISHED", "RUNNING"} |
the tag states accepted for processing | |
std::optional< boost::python::object > | m_callback |
the callback function to determine the final final list of globaltags | |
bool | m_databaseInitialized {false} |
bool indicating whether the database has been initialized, in which case any changes to the configuration object would not be reflected by the database setup so we refuse them | |
Class to enable configuration of the conditions database access in C++ and python.
This class contains all settings relevant for the usage of the conditions database.
Mostly this class is just a container for user settings without much intelligence. The only thing it does is construct the final list of globaltags to be used from input data and user settings, maybe via a user callback, in getFinalListOfTags().
the exposePythonAPI() function contains detailed documentation to most of the members in this class for the python interface and details all of the settings.
Definition at line 61 of file Configuration.h.
|
inline |
Append a globaltag.
Definition at line 78 of file Configuration.h.
|
inline |
Append a metadata provider to the list.
Definition at line 222 of file Configuration.h.
|
inline |
Append a payload to the list of locations.
Definition at line 248 of file Configuration.h.
|
inline |
Add a local text file with testing payloads.
Definition at line 194 of file Configuration.h.
|
inline |
Disable global tag replay.
This restores the previous behavior of just using the default globaltag and is just a shortcut for calling overrideGlobalTags() and appending each tag in getDefaultGlobalTags() tho the list of globaltags using appendGlobalTag()
Definition at line 152 of file Configuration.h.
|
inlineprivate |
Check whether the configuration object can be edited or if the database has been initialized already.
Definition at line 314 of file Configuration.h.
|
inlinestaticprivate |
Fill a target object from a list of environment variables.
Definition at line 308 of file Configuration.h.
std::vector< std::string > getBaseTags | ( | ) | const |
Get the base globaltags to be used in addition to user globaltags.
|
inline |
Get the default URL where to look for the metadata provider.
Definition at line 234 of file Configuration.h.
|
inline |
Get the directory where to place downloaded payloads.
Empty string is shorthand to put them in a folder basf2-conditions
in the temp dir
Definition at line 282 of file Configuration.h.
|
inline |
Get the timout we try to lock a file in the download cache directory for downloading.
Definition at line 287 of file Configuration.h.
std::vector< std::string > getFinalListOfTags | ( | ) |
Get the final list of globaltags to be used for processing.
|
inline |
Get the list of user globaltags.
Definition at line 86 of file Configuration.h.
|
inline |
Get the list of user globaltags as python version.
Definition at line 88 of file Configuration.h.
|
inline |
|
inline |
|
inline |
Get the filename where to save newly created payload information.
Definition at line 275 of file Configuration.h.
|
inline |
|
inline |
|
inline |
|
inline |
Get the list of text files containing test payloads in python.
Definition at line 204 of file Configuration.h.
|
inline |
Get the set of usable globaltag states allowed to be used for processing.
Definition at line 293 of file Configuration.h.
|
inline |
Check if override is enabled by previous calls to overrideGlobalTags()
Definition at line 143 of file Configuration.h.
|
inline |
Enable globaltag override: If this is called once than overrideEnabled() will return true and getFinalListOfTags() will just return getGlobalTags()
Definition at line 139 of file Configuration.h.
|
inline |
preprend a globaltag
Definition at line 80 of file Configuration.h.
|
inline |
|
inline |
|
inline |
Prepend a local text file with testing payloads to the list.
Definition at line 196 of file Configuration.h.
|
inline |
Set the directory where to place downloaded payloads.
Empty string is shorthand to put them in a folder basf2-conditions
in the temp dir
Definition at line 279 of file Configuration.h.
|
inline |
Set the timout we try to lock a file in the download cache directory for downloading.
Definition at line 285 of file Configuration.h.
|
inline |
Set a callback function from python which will be called when processing starts and should return the final list of globaltags to be used.
See the python documentation for more details
Definition at line 298 of file Configuration.h.
|
inline |
|
inline |
Set the list of globaltags from python.
Definition at line 84 of file Configuration.h.
|
inline |
Set by the Database singleton upon initialization and cleanup.
Definition at line 303 of file Configuration.h.
|
inline |
To be called by input modules with the tags to be added from input files.
This method is to be called by input modules which know the list of globaltags to be used but cannot provide FileMetaData instances for these input files.
In case an empty list is put in this means global tag replay is not possible for these input files and the user will need to manually supply all tags and use the override flag to disable any attempt at tag replay.
Definition at line 108 of file Configuration.h.
void setInputMetadata | ( | const std::vector< FileMetaData > & | inputMetadata | ) |
To be called by input modules with the list of all input FileMetaData.
This method is to be called by input modules which have a full list of FileMetaData instances for all input files. It will then check if all instances have a compatible globaltag setting and call setInputGlobalTags
accordingly.
|
inline |
|
inline |
|
inline |
Set the file where to save newly created payload information.
Definition at line 273 of file Configuration.h.
|
inline |
|
inline |
|
inline |
Set the list of local text files to look for testing payloads.
Definition at line 198 of file Configuration.h.
|
inline |
Set the list of text files containing test payloads in python.
Definition at line 200 of file Configuration.h.
|
inline |
Set the set of usable globaltag states to be allowed for processing.
The state INVALID will always be ignored and not permitted
Definition at line 291 of file Configuration.h.
|
private |
the callback function to determine the final final list of globaltags
Definition at line 345 of file Configuration.h.
|
private |
bool indicating whether the database has been initialized, in which case any changes to the configuration object would not be reflected by the database setup so we refuse them
Definition at line 348 of file Configuration.h.
|
private |
default URL where to look for the metadata provider
Definition at line 335 of file Configuration.h.
|
private |
the directory to put newly downloaded payloads
Definition at line 339 of file Configuration.h.
|
private |
the timeout when trying to lock files in the download directory
Definition at line 341 of file Configuration.h.
|
private |
the list with all user globaltags
Definition at line 327 of file Configuration.h.
|
private |
the list of globaltags from all the input files to be used in addition to the user globaltags
Definition at line 323 of file Configuration.h.
|
private |
the file metadata of all input files if globaltag replay is requested by input module
Definition at line 325 of file Configuration.h.
|
private |
the list with all the metadata providers
Definition at line 331 of file Configuration.h.
|
private |
the file to put the newly created payload information
Definition at line 337 of file Configuration.h.
|
private |
is the globaltag override enabled?
Definition at line 320 of file Configuration.h.
|
private |
the list with all the payload locations
Definition at line 333 of file Configuration.h.
|
private |
the files with testing payloads to use during processing
Definition at line 329 of file Configuration.h.
|
private |
the tag states accepted for processing
Definition at line 343 of file Configuration.h.