Commit 1e2c28ca authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'IOVDbSvc_propDef' into 'master'

IOVDbSvc: Eleminate constructor

See merge request atlas/athena!29318
parents 9e3de8a2 82a73071
......@@ -9,17 +9,16 @@
#include "StoreGate/StoreGateSvc.h"
#include "StoreGate/StoreClearedIncident.h"
#include "GaudiKernel/IAddressCreator.h"
#include "GaudiKernel/IJobOptionsSvc.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "GaudiKernel/Guards.h"
#include "AthenaKernel/IOVRange.h"
#include "IOVDbDataModel/IOVMetaDataContainer.h"
#include "IOVDbMetaDataTools/IIOVDbMetaDataTool.h"
#include "PoolSvc/IPoolSvc.h"
#include "AthenaKernel/IAddressProvider.h"
#include "FileCatalog/IFileCatalog.h"
#include "EventInfoMgt/ITagInfoMgr.h"
#include "EventInfo/TagInfo.h"
#include "EventInfoUtils/EventIDFromStore.h"
......@@ -54,63 +53,6 @@ namespace {
} // anonymous namespace
IOVDbSvc::IOVDbSvc( const std::string& name, ISvcLocator* svc )
: AthService( name, svc ),
m_par_defaultConnection("sqlite://;schema=cooldummy.db;dbname=OFLP200"),
m_par_globalTag(""),m_par_dbinst(""),
m_par_manageConnections(true),
m_par_managePoolConnections(true),
m_par_forceRunNumber(0), // default no global force run number
m_par_forceLumiblockNumber(0), // Default no global force LB
m_par_maxNumPoolFiles(5), // Default=0 means no limit
m_par_timeStampSlop(0.0), // default of 0 seconds
m_par_cacheRun(0),
m_par_cacheTime(0),
m_par_cacheAlign(0),
m_par_onlineMode(false),
m_par_checklock(false),
m_par_source("COOL_DATABASE"),
m_par_format(""), //default format for the source is empty
m_h_IOVSvc ("IOVSvc", name),
m_h_sgSvc ("StoreGateSvc", name),
m_h_detStore ("DetectorStore", name),
m_h_metaDataStore ("StoreGateSvc/MetaDataStore", name),
m_h_persSvc ("EventPersistencySvc", name),
m_h_clidSvc ("ClassIDSvc", name),
m_h_poolSvc ("PoolSvc", name),
m_h_metaDataTool("IOVDbMetaDataTool"),
m_h_tagInfoMgr("TagInfoMgr", name),
m_poolPayloadRequested(false),
m_poolSvcContext(0),
m_state (INITIALIZATION),
m_globalTag(""),
m_iovslop(),
m_abort(false)
{
// declare all properties
declareProperty("dbConnection", m_par_defaultConnection);
declareProperty("GlobalTag", m_par_globalTag );
declareProperty("DBInstance", m_par_dbinst);
declareProperty("Folders", m_par_folders );
declareProperty("overrideTags", m_par_overrideTags);
declareProperty("forceRunNumber", m_par_forceRunNumber );
declareProperty("forceLumiblockNumber", m_par_forceLumiblockNumber);
declareProperty("forceTimestamp", m_par_forceTimestamp);
declareProperty("ManageConnections", m_par_manageConnections );
declareProperty("ManagePoolConnections", m_par_managePoolConnections );
declareProperty("FoldersToMetaData", m_par_foldersToWrite );
declareProperty("MaxPoolFilesOpen", m_par_maxNumPoolFiles ); // maximum number of pools files allowed to be open at once
declareProperty("TimeStampSlop", m_par_timeStampSlop);
declareProperty("CacheRun", m_par_cacheRun);
declareProperty("CacheTime", m_par_cacheTime);
declareProperty("CacheAlign", m_par_cacheAlign);
declareProperty("OnlineMode", m_par_onlineMode);
declareProperty("CheckLock", m_par_checklock);
declareProperty("Source", m_par_source);
declareProperty("Format", m_par_format);
declareProperty("OutputToFile", m_outputToFile);
}
IOVDbSvc::~IOVDbSvc() {}
/// Identify interfaces to which this service is responsive
......@@ -187,7 +129,7 @@ StatusCode IOVDbSvc::initialize() {
// initialise default connection
if (m_par_defaultConnection!="") {
// default connection is readonly if no : in name (i.e. logical conn)
bool readonly=(m_par_defaultConnection.find(':')==std::string::npos);
bool readonly=(m_par_defaultConnection.value().find(':')==std::string::npos);
m_connections.push_back(new IOVDbConn(m_par_defaultConnection,readonly,msg()));
}
......@@ -207,7 +149,7 @@ StatusCode IOVDbSvc::initialize() {
m_state=IOVDbSvc::INITIALIZATION;
ATH_MSG_INFO( "Initialised with " << m_connections.size() <<
" connections and " << m_foldermap.size() << " folders" );
if (m_outputToFile) ATH_MSG_INFO("Db dump to file activated");
if (m_outputToFile.value()) ATH_MSG_INFO("Db dump to file activated");
ATH_MSG_INFO( "Service IOVDbSvc initialised successfully" );
return StatusCode::SUCCESS;
}
......@@ -896,7 +838,7 @@ StatusCode IOVDbSvc::setupFolders() {
//1. Loop through folders
std::list<IOVDbParser> allFolderdata;
for (const auto & thisFolder : m_par_folders) {
for (const auto & thisFolder : m_par_folders.value()) {
ATH_MSG_DEBUG( "Setup folder " << thisFolder );
IOVDbParser folderdata(thisFolder,msg());
if (!folderdata.isValid()) return StatusCode::FAILURE;
......@@ -986,7 +928,7 @@ StatusCode IOVDbSvc::setupFolders() {
// create the new folder, but only if a folder for this SG key has not
// already been requested
IOVDbFolder* folder=new IOVDbFolder(conn,folderdata,msg(),&(*m_h_clidSvc),
m_par_checklock, m_outputToFile, m_par_source);
m_par_checklock, m_outputToFile.value(), m_par_source);
const std::string& key=folder->key();
if (m_foldermap.find(key)==m_foldermap.end()) { //This check is too weak. For POOL-based folders, the SG key is in the folder description (not known at this point).
m_foldermap[key]=folder;
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
/**
......@@ -24,13 +24,15 @@
#include "GaudiKernel/IIncidentListener.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/IAddressCreator.h"
#include "SGTools/DataProxy.h"
#include "EventInfoMgt/ITagInfoMgr.h"
#include "PoolSvc/IPoolSvc.h"
#include "IOVDbMetaDataTools/IIOVDbMetaDataTool.h"
#include "AthenaKernel/IIOVSvc.h"
#include "AthenaKernel/IIOVDbSvc.h"
#include "IOVDbSvc/IIOVCondDbSvc.h"
#include "AthenaKernel/IAddressProvider.h"
#include "AthenaKernel/IOVTime.h"
#include "CoolKernel/IDatabase.h"
......@@ -46,17 +48,14 @@
class IOVSvc;
class IOVTime;
class IOVRange;
class StoreGateSvc;
class IAddressCreator;
class StoreGateSvc;
class IClassIDSvc;
class IPoolSvc;
class EventID;
class ITagInfoMgr;
class IOVDbFolder;
class IIOVDbMetaDataTool;
class IOVMetaDataContainer;
class CondAttrListCollection;
......@@ -83,7 +82,8 @@ class IOVDbSvc : public virtual IIOVCondDbSvc,
public:
IOVDbSvc( const std::string& name, ISvcLocator* svc );
/// Forward base class ctor
using AthService::AthService;
virtual ~IOVDbSvc();
/// Service init
......@@ -180,67 +180,67 @@ private:
// job option parameters
// default database connection
std::string m_par_defaultConnection;
Gaudi::Property<std::string> m_par_defaultConnection{this,"dbConnection","sqlite://;schema=cooldummy.db;dbname=OFLP200","default DB connection string"};
// IOVDbSvc global tag
std::string m_par_globalTag;
Gaudi::Property<std::string> m_par_globalTag{this,"GlobalTag","","Global database tag"};
// production database instance, used to cross-check global tag
std::string m_par_dbinst;
Gaudi::Property<std::string> m_par_dbinst{this,"DBInstance","","Database instance (like OFLP200)"};
// a list of folders to preload
std::vector<std::string> m_par_folders;
Gaudi::Property<std::vector<std::string> > m_par_folders{this,"Folders",{},"List of database folders to preload"};
// a list of overriding tags definitions
std::vector<std::string> m_par_overrideTags;
Gaudi::Property<std::vector<std::string> > m_par_overrideTags{this,"overrideTags",{},"List of foolder-tag overrides"};
// a list of folders to write to file meta data
std::vector<std::string> m_par_foldersToWrite;
Gaudi::Property<std::vector<std::string> > m_par_foldersToWrite{this,"FoldersToMetaData",{},"list of folders to write to file meta data"};
// a flag to trigger the connections management
BooleanProperty m_par_manageConnections;
BooleanProperty m_par_manageConnections{this,"ManageConnections",true,"flag to trigger the connections management"};
// a flag to manage pool connections
BooleanProperty m_par_managePoolConnections;
BooleanProperty m_par_managePoolConnections{this,"ManagePoolConnections",true,"flag to manage pool connections"};
// a global force run number
IntegerProperty m_par_forceRunNumber;
IntegerProperty m_par_forceRunNumber{this,"forceRunNumber",0,"globally force run-number (default: no force)"};
// a global force lumiblock number
IntegerProperty m_par_forceLumiblockNumber;
IntegerProperty m_par_forceLumiblockNumber{this,"forceLumiblockNumber",0,"globally force LB-number (default: no force)"};
// a global force timestamp
IntegerProperty m_par_forceTimestamp;
IntegerProperty m_par_forceTimestamp{this,"forceTimeStamp",0,"globally force time-stamp (default: no force)"};
// max number of pool files open allowed
IntegerProperty m_par_maxNumPoolFiles;
IntegerProperty m_par_maxNumPoolFiles{this,"MaxPoolFilesOpen",5,"max number of pool files open allowed (0 means no limit)"};
// timestampslop - backdata timestamp IOVs by this many seconds
FloatProperty m_par_timeStampSlop;
FloatProperty m_par_timeStampSlop{this,"TimeStampSlop",0.0,"backdata timestamp IOVs by this many seconds"};
// force larger numbers of runs to be cached
IntegerProperty m_par_cacheRun;
IntegerProperty m_par_cacheRun{this,"CacheRun",0,"force larger numbers of runs to be cached"};
// force larger timeranges to be cached (seconds)
IntegerProperty m_par_cacheTime;
IntegerProperty m_par_cacheTime{this,"CacheTime",0,"force larger timeranges to be cached (seconds)"};
// cache alignment - divide cache into N slices and align queries on slice
// should be useful to improve Frontier cache hit rate
UnsignedIntegerProperty m_par_cacheAlign;
UnsignedIntegerProperty m_par_cacheAlign{this,"CacheAlign",0,"cache alignment - divide cache into N slices and align queries on slice"};
// online mode flag to ignore missing channels outside cache range
BooleanProperty m_par_onlineMode;
BooleanProperty m_par_onlineMode{this,"OnlineMode",false,"online mode flag to ignore missing channels outside cache range"};
// check to ensure global/HVS tags are locked (for production)
BooleanProperty m_par_checklock;
BooleanProperty m_par_checklock{this,"CheckLock",false,"check to ensure global/HVS tags are locked (for production)"};
// Source of data as a string; default is "COOL_DATABASE"
std::string m_par_source{};
StringProperty m_par_source{this,"Source","COOL_DATABASE","source of data as a string (default COOL_DATABASE)"};
// Format of data; default is empty string (default for a given source)
std::string m_par_format{};
StringProperty m_par_format{this,"Format",{},"Format of data; default is empty string (default for a given source)"};
// Can output to file for debugging purposes
bool m_outputToFile{false};
BooleanProperty m_outputToFile{this,"OutputToFile",false,"output to file for debugging purposes"};
// internal parameters
// handles to other services and tools
ServiceHandle<IIOVSvc> m_h_IOVSvc;
ServiceHandle<StoreGateSvc> m_h_sgSvc;
ServiceHandle<StoreGateSvc> m_h_detStore;
ServiceHandle<StoreGateSvc> m_h_metaDataStore;
ServiceHandle<IAddressCreator> m_h_persSvc;
ServiceHandle<IClassIDSvc> m_h_clidSvc;
ServiceHandle<IPoolSvc> m_h_poolSvc;
ToolHandle<IIOVDbMetaDataTool> m_h_metaDataTool;
ServiceHandle<ITagInfoMgr> m_h_tagInfoMgr;
ServiceHandle<IIOVSvc> m_h_IOVSvc{this,"IOVSvc","IOVSvc"};
ServiceHandle<StoreGateSvc> m_h_sgSvc{this,"StoreGateSvc","StoreGateSvc"};
ServiceHandle<StoreGateSvc> m_h_detStore{this,"DetectorStore","DetectorStore"};
ServiceHandle<StoreGateSvc> m_h_metaDataStore{this,"MetaDataStore","StoreGateSvc/MetaDataStore"};
ServiceHandle<IAddressCreator> m_h_persSvc{this,"EventPersistencySvc","EventPersistencySvc"};
ServiceHandle<IClassIDSvc> m_h_clidSvc{this,"ClassIDSvc","ClassIDSvc"};
ServiceHandle<IPoolSvc> m_h_poolSvc{this,"PoolSvc","PoolSvc"};
PublicToolHandle<IIOVDbMetaDataTool> m_h_metaDataTool{this,"IOVDbMetaDataTool","IOVDbMetaDataTool"};
ServiceHandle<ITagInfoMgr> m_h_tagInfoMgr{this,"TagInfoMgr","TagInfoMgr"};
// Flag to signal when a pool payload has been requested. This
// implies that a pool file has been open during an event, and will
// allow one to close the pool file and the end of event.
bool m_poolPayloadRequested;
bool m_poolPayloadRequested{false};
// Pool service context
unsigned int m_poolSvcContext;
unsigned int m_poolSvcContext{0};
// Flag to keep track of which state we are in to know
// how to obtain the IOV time, i.e. during:
......@@ -254,16 +254,16 @@ private:
EVENT_LOOP,
FINALIZE_ALG
};
IOVDbSvc_state m_state;
IOVDbSvc_state m_state{INITIALIZATION};
// IOVTime to be set during initialation or begin run
IOVTime m_iovTime;
IOVTime m_iovTime{};
// Global tag from TagInfo or joboptions
std::string m_globalTag;
std::string m_globalTag{};
// IOV value to be subtraced for timeStampSlop
cool::ValidityKey m_iovslop;
cool::ValidityKey m_iovslop{};
// vector of managed connections
typedef std::vector<IOVDbConn*> ConnVec;
......@@ -272,7 +272,7 @@ private:
typedef std::map<std::string,IOVDbFolder*> FolderMap;
FolderMap m_foldermap;
// gloal abort flag
bool m_abort;
bool m_abort{false};
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment