 |
Belle II Software
release-05-02-19
|
12 #include <framework/utilities/EnvironmentVariables.h>
13 #include <framework/dataobjects/FileMetaData.h>
15 #include <boost/python/list.hpp>
16 #include <boost/python/tuple.hpp>
21 namespace Belle2::Conditions {
38 void append(
const std::string& element);
40 void prepend(
const std::string& element);
43 void shallowCopy(
const boost::python::object& source);
46 std::variant<std::vector<std::string>, boost::python::list>
m_value;
307 template<
class T>
static void fillFromEnv(T& target,
const std::string& envName,
const std::string& defaultValue)
310 for (
const std::string& v : values) target.append(v);
316 throw std::runtime_error(
"Database already initialized, please reset before changing the configuration object");
void prependGlobalTag(const std::string &globalTag)
preprend a globaltag
bool m_databaseInitialized
bool indicating whether the database has been initialized, in which case any changes to the configura...
boost::python::list getPayloadLocationsPy()
Get the list og payload locations in python.
static std::vector< std::string > getOrCreateList(const std::string &name, const std::string &fallback, const std::string &separators=" \t\n\r")
Get a list of values from an environment variable or the given fallback string if the variable is not...
bool overrideEnabled() const
Check if override is enabled by previous calls to overrideGlobalTags()
void prependPayloadLocation(const std::string &location)
Prepend a payload to the list of locations.
void prepend(const std::string &element)
Prepend an element to whatever representation we currently have.
boost::python::list getGlobalTagsPy()
Get the list of user globaltags as python version.
static void fillFromEnv(T &target, const std::string &envName, const std::string &defaultValue)
Fill a target object from a list of environment variables.
void overrideGlobalTags()
Enable globaltag override: If this is called once than overrideEnabled() will return true and getFina...
std::variant< std::vector< std::string >, boost::python::list > m_value
Store either a std::vector or a python list of strings.
bool m_overrideEnabled
is the globaltag override enabled?
Wrapper class for a list of strings to either be held in a std::vector or in a python list.
std::vector< std::string > getMetadataProviders()
Get the list of metadata providers.
void setGlobaltagCallbackPy(const boost::python::object &obj)
Set a callback function from python which will be called when processing starts and should return the...
std::set< std::string > m_usableTagStates
the tag states accepted for processing
CppOrPyList m_metadataProviders
the list with all the metadata providers
void appendMetadataProvider(const std::string &provider)
Append a metadata provider to the list.
std::string m_downloadCacheDirectory
the directory to put newly downloaded payloads
void append(const std::string &element)
Append an element to whatever representation we currently have.
std::vector< FileMetaData > m_inputMetadata
the file metadata of all input files if globaltag replay is requested by input module
std::vector< std::string > & ensureCpp()
Return the C++ vector version.
void setMetadataProvidersPy(const boost::python::list &list)
Set the list of metadata providers in python.
void setGlobalTags(const std::vector< std::string > &list)
Set the list of globaltags.
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
static void exposePythonAPI()
expose this class to python
boost::python::list getTestingPayloadLocationsPy()
Get the list of text files containing test payloads in python.
void setInputGlobaltags(const std::vector< std::string > &inputTags)
To be called by input modules with the tags to be added from input files.
boost::python::list getMetadataProvidersPy()
Get the list of metadata providers in python.
void setUsableTagStates(const std::set< std::string > &states)
Set the set of usable globaltag states to be allowed for processing.
std::vector< std::string > getBaseTags() const
Get the base globaltags to be used in addition to user globaltags.
std::string getNewPayloadLocation() const
Get the filename where to save newly created payload information.
std::vector< std::string > getPayloadLocations()
Get the list of payload locations.
std::optional< boost::python::object > m_callback
the callback function to determine the final final list of globaltags
CppOrPyList m_payloadLocations
the list with all the payload locations
std::vector< std::string > getTestingPayloadLocations()
Get the list of testing payload locations.
void appendPayloadLocation(const std::string &location)
Append a payload to the list of locations.
size_t m_downloadLockTimeout
the timeout when trying to lock files in the download directory
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
std::vector< std::string > getFinalListOfTags()
Get the final list of globaltags to be used for processing.
void setMetadataProviders(const std::vector< std::string > &list)
Set the list of metadata providers.
Class to enable configuration of the conditions database access in C++ and python.
void setNewPayloadLocation(const std::string &filename)
Set the file where to save newly created payload information.
void overrideGlobalTagsPy(const boost::python::list &globalTags)
Enable globaltag override and set the list of user globaltags in one go.
std::string m_newPayloadFile
the file to put the newly created payload information
std::vector< std::string > getDefaultGlobalTags() const
Get the std::vector of default globaltags.
const std::set< std::string > & getUsableTagStates() const
Get the set of usable globaltag states allowed to be used for processing.
void ensureEditable() const
Check whether the configuration object can be edited or if the database has been initialized already.
void appendGlobalTag(const std::string &globalTag)
Append a globaltag.
void setInputMetadata(const std::vector< FileMetaData > &inputMetadata)
To be called by input modules with the list of all input FileMetaData.
void prependMetadataProvider(const std::string &provider)
Prepend a metadata provider to the list.
void appendTestingPayloadLocation(const std::string &filename)
Add a local text file with testing payloads.
boost::python::list & ensurePy()
Return the python list version.
Configuration()
Initialize default values.
void setTestingPayloadLocationsPy(const boost::python::list &list)
Set the list of text files containing test payloads in python.
void setGlobalTagsPy(const boost::python::list &globalTags)
Set the list of globaltags from python.
void setPayloadLocationsPy(const boost::python::list &list)
Set the list of payload locations in python.
void setInitialized(bool value)
Set by the Database singleton upon initialization and cleanup.
void setPayloadLocations(const std::vector< std::string > &list)
Set the list of payload locations.
CppOrPyList m_testingPayloadLocations
the files with testing payloads to use during processing
void prependTestingPayloadLocation(const std::string &filename)
Prepend a local text file with testing payloads to the list.
void disableGlobalTagReplay()
Disable global tag replay.
CppOrPyList m_globalTags
the list with all user globaltags
std::vector< std::string > getGlobalTags()
Get the list of user globaltags.
void reset()
Reset to default values.
void setTestingPayloadLocations(const std::vector< std::string > &list)
Set the list of local text files to look for testing payloads.
size_t getDownloadLockTimeout() const
Get the timout we try to lock a file in the download cache directory for downloading.
void setDownloadCacheDirectory(const std::string &directory)
Set the directory where to place downloaded payloads.
void shallowCopy(const boost::python::object &source)
shallow copy all elements of the source object into the python representation.
void setDownloadLockTimeout(size_t timeout)
Set the timout we try to lock a file in the download cache directory for downloading.
boost::python::tuple getDefaultGlobalTagsPy() const
Get the tuple of default globaltags as python version.
std::string getDownloadCacheDirectory() const
Get the directory where to place downloaded payloads.