CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
edm::service::SiteLocalConfigService Class Reference

#include <SiteLocalConfigService.h>

Inheritance diagram for edm::service::SiteLocalConfigService:
edm::SiteLocalConfig

Public Member Functions

std::vector< edm::CatalogAttributes > const & dataCatalogs () const override
 
unsigned int debugLevel () const override
 
bool enablePrefetching () const override
 
std::string const & localConnectPrefix () const override
 
std::string const & localConnectSuffix () const override
 
std::string const lookupCalibConnect (std::string const &input) const override
 
std::string const rfioType (void) const override
 
 SiteLocalConfigService (ParameterSet const &pset)
 
std::string const & siteName () const override
 
std::string const * sourceCacheHint () const override
 
double const * sourceCacheMinFree () const override
 
std::string const * sourceCacheTempDir () const override
 
std::string const * sourceCloneCacheHint () const override
 
std::vector< std::string > const * sourceNativeProtocols () const override
 
std::string const * sourceReadHint () const override
 
unsigned int const * sourceTimeout () const override
 
unsigned int const * sourceTTreeCacheSize () const override
 
struct addrinfo const * statisticsDestination () const override
 
std::set< std::string > const * statisticsInfo () const override
 
std::filesystem::path const storageDescriptionPath (edm::CatalogAttributes const &aDataCatalog) const override
 
std::string const & subSiteName () const override
 
std::vector< std::string > const & trivialDataCatalogs () const override
 
bool useLocalConnectString () const override
 
 ~SiteLocalConfigService () override
 
- Public Member Functions inherited from edm::SiteLocalConfig
 SiteLocalConfig ()
 
virtual ~SiteLocalConfig ()
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void computeStatisticsDestination ()
 
std::string const frontierConnect (std::string const &servlet) const
 
void getCatalog (tinyxml2::XMLElement const &cat, std::string site, std::string subSite)
 
void parse (std::string const &url)
 

Private Attributes

std::string m_cacheHint
 
std::string const * m_cacheHintPtr
 
double m_cacheMinFree
 
double const * m_cacheMinFreePtr
 
std::string m_cacheTempDir
 
std::string const * m_cacheTempDirPtr
 
std::string m_cloneCacheHint
 
std::string const * m_cloneCacheHintPtr
 
bool m_connected
 
std::vector< edm::CatalogAttributesm_dataCatalogs
 
unsigned int m_debugLevel
 
bool m_enablePrefetching
 
bool const * m_enablePrefetchingPtr
 
std::string m_frontierConnect
 
std::string m_localConnectPrefix
 
std::string m_localConnectSuffix
 
std::vector< std::string > m_nativeProtocols
 
std::vector< std::string > const * m_nativeProtocolsPtr
 
std::string m_readHint
 
std::string const * m_readHintPtr
 
std::string m_rfioType
 
std::string m_siteName
 
edm::propagate_const< struct addrinfo * > m_statisticsAddrInfo
 
std::string m_statisticsDestination
 
std::set< std::string > m_statisticsInfo
 
bool m_statisticsInfoAvail
 
std::string m_subSiteName
 
unsigned int m_timeout
 
unsigned int const * m_timeoutPtr
 
std::vector< std::string > m_trivialDataCatalogs
 
unsigned int m_ttreeCacheSize
 
unsigned int const * m_ttreeCacheSizePtr
 
std::string m_url
 
bool m_useLocalConnectString = false
 

Static Private Attributes

static const std::string m_statisticsDefaultPort = "3334"
 

Detailed Description

Definition at line 34 of file SiteLocalConfigService.h.

Constructor & Destructor Documentation

◆ SiteLocalConfigService()

edm::service::SiteLocalConfigService::SiteLocalConfigService ( ParameterSet const &  pset)
explicit

Definition at line 76 of file SiteLocalConfigService.cc.

References computeStatisticsDestination(), mps_splice::entry, m_cacheHint, m_cacheHintPtr, m_cacheMinFree, m_cacheMinFreePtr, m_cacheTempDir, m_cacheTempDirPtr, m_cloneCacheHint, m_cloneCacheHintPtr, m_debugLevel, m_enablePrefetching, m_enablePrefetchingPtr, m_localConnectPrefix, m_localConnectSuffix, m_nativeProtocols, m_nativeProtocolsPtr, m_readHint, m_readHintPtr, m_statisticsDestination, m_statisticsInfo, m_statisticsInfoAvail, m_timeout, m_timeoutPtr, m_ttreeCacheSize, m_ttreeCacheSizePtr, m_url, m_useLocalConnectString, eostools::move(), parse(), muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

77  : m_url(pset.getUntrackedParameter<std::string>("siteLocalConfigFileUrl", defaultURL())),
81  m_rfioType("castor"),
82  m_connected(false),
84  m_cacheTempDirPtr(nullptr),
86  m_cacheMinFreePtr(nullptr),
87  m_cacheHint(),
88  m_cacheHintPtr(nullptr),
90  m_cloneCacheHintPtr(nullptr),
91  m_readHint(),
92  m_readHintPtr(nullptr),
94  m_ttreeCacheSizePtr(nullptr),
95  m_timeout(0U),
96  m_timeoutPtr(nullptr),
97  m_debugLevel(0U),
98  m_enablePrefetching(false),
99  m_enablePrefetchingPtr(nullptr),
101  m_nativeProtocolsPtr(nullptr),
103  m_statisticsAddrInfo(nullptr),
104  m_statisticsInfoAvail(false),
105  m_siteName(),
106  m_subSiteName() {
107  this->parse(m_url);
108 
109  //apply overrides
110  overrideFromPSet("overrideSourceCacheTempDir", pset, m_cacheTempDir, m_cacheTempDirPtr);
111  overrideFromPSet("overrideSourceCacheMinFree", pset, m_cacheMinFree, m_cacheMinFreePtr);
112  overrideFromPSet("overrideSourceCacheHintDir", pset, m_cacheHint, m_cacheHintPtr);
113  overrideFromPSet("overrideSourceCloneCacheHintDir", pset, m_cloneCacheHint, m_cloneCacheHintPtr);
114  overrideFromPSet("overrideSourceReadHint", pset, m_readHint, m_readHintPtr);
115  overrideFromPSet("overrideSourceNativeProtocols", pset, m_nativeProtocols, m_nativeProtocolsPtr);
116  overrideFromPSet("overrideSourceTTreeCacheSize", pset, m_ttreeCacheSize, m_ttreeCacheSizePtr);
117  overrideFromPSet("overrideSourceTimeout", pset, m_timeout, m_timeoutPtr);
118  overrideFromPSet("overridePrefetching", pset, m_enablePrefetching, m_enablePrefetchingPtr);
119  const std::string *tmpStringPtr = nullptr;
120  overrideFromPSet("overrideStatisticsDestination", pset, m_statisticsDestination, tmpStringPtr);
122  std::vector<std::string> tmpStatisticsInfo;
123  std::vector<std::string> const *tmpStatisticsInfoPtr = nullptr;
124  overrideFromPSet("overrideStatisticsInfo", pset, tmpStatisticsInfo, tmpStatisticsInfoPtr);
125  if (tmpStatisticsInfoPtr) {
126  m_statisticsInfoAvail = true;
127  m_statisticsInfo.clear();
128  for (auto &entry : tmpStatisticsInfo) {
130  }
131  }
132 
133  if (pset.exists("debugLevel")) {
134  m_debugLevel = pset.getUntrackedParameter<unsigned int>("debugLevel");
135  }
136  if (pset.exists("overrideUseLocalConnectString")) {
137  m_useLocalConnectString = pset.getUntrackedParameter<bool>("overrideUseLocalConnectString");
138  }
139  if (pset.exists("overrideLocalConnectPrefix")) {
140  m_localConnectPrefix = pset.getUntrackedParameter<std::string>("overrideLocalConnectPrefix");
141  }
142  if (pset.exists("overrideLocalConnectSuffix")) {
143  m_localConnectSuffix = pset.getUntrackedParameter<std::string>("overrideLocalConnectSuffix");
144  }
145  }
std::vector< edm::CatalogAttributes > m_dataCatalogs
std::vector< std::string > const * m_nativeProtocolsPtr
std::vector< std::string > m_trivialDataCatalogs
edm::propagate_const< struct addrinfo * > m_statisticsAddrInfo
std::vector< std::string > m_nativeProtocols
def move(src, dest)
Definition: eostools.py:511

◆ ~SiteLocalConfigService()

edm::service::SiteLocalConfigService::~SiteLocalConfigService ( )
override

Definition at line 147 of file SiteLocalConfigService.cc.

References m_statisticsAddrInfo.

147  {
148  if (m_statisticsAddrInfo) {
149  freeaddrinfo(m_statisticsAddrInfo);
150  m_statisticsAddrInfo = nullptr;
151  }
152  }
edm::propagate_const< struct addrinfo * > m_statisticsAddrInfo

Member Function Documentation

◆ computeStatisticsDestination()

void edm::service::SiteLocalConfigService::computeStatisticsDestination ( )
private

Definition at line 555 of file SiteLocalConfigService.cc.

References MillePedeFileConverter_cfg::e, query::host, m_statisticsAddrInfo, m_statisticsDefaultPort, m_statisticsDestination, query::port, submitPVValidationJobs::split(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiteLocalConfigService().

555  {
556  std::vector<std::string> inputStrings;
557  boost::split(inputStrings, m_statisticsDestination, boost::is_any_of(":"));
558  const std::string &host = inputStrings[0];
559  const std::string &port = (inputStrings.size() > 1) ? inputStrings[1] : m_statisticsDefaultPort;
560  struct addrinfo *res;
561  struct addrinfo hints;
562  memset(&hints, '\0', sizeof(hints));
563  hints.ai_socktype = SOCK_DGRAM;
564  hints.ai_flags = AI_ADDRCONFIG;
565  hints.ai_family = AF_UNSPEC;
566  int e = getaddrinfo(host.c_str(), port.c_str(), &hints, &res);
567  if (e != 0) {
568  // Silent failure - there's no way to report non-fatal failures from here.
569  return;
570  }
572  }
string host
Definition: query.py:115
static const std::string m_statisticsDefaultPort
int port
Definition: query.py:116
Definition: Electron.h:6
edm::propagate_const< struct addrinfo * > m_statisticsAddrInfo

◆ dataCatalogs()

std::vector< edm::CatalogAttributes > const & edm::service::SiteLocalConfigService::dataCatalogs ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 170 of file SiteLocalConfigService.cc.

References cms::Exception::addContext(), m_connected, m_dataCatalogs, and m_url.

170  {
171  if (!m_connected) {
172  cms::Exception ex("SiteLocalConfigService");
173  ex << "Incomplete configuration. Valid site-local-config not found at " << m_url;
174  ex.addContext("edm::SiteLocalConfigService::dataCatalogs()");
175  throw ex;
176  }
177  if (m_dataCatalogs.empty()) {
178  cms::Exception ex("SiteLocalConfigService");
179  ex << "Did not find catalogs in data-access section in " << m_url;
180  ex.addContext("edm::SiteLocalConfigService::dataCatalogs()");
181  throw ex;
182  }
183  return m_dataCatalogs;
184  }
std::vector< edm::CatalogAttributes > m_dataCatalogs

◆ debugLevel()

unsigned int edm::service::SiteLocalConfigService::debugLevel ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 307 of file SiteLocalConfigService.cc.

References m_debugLevel.

◆ enablePrefetching()

bool edm::service::SiteLocalConfigService::enablePrefetching ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 303 of file SiteLocalConfigService.cc.

References m_enablePrefetchingPtr.

303  {
305  }

◆ fillDescriptions()

void edm::service::SiteLocalConfigService::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 574 of file SiteLocalConfigService.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

574  {
576  desc.setComment("Service to translate logical file names to physical file names.");
577 
578  desc.addOptionalUntracked<std::string>("siteLocalConfigFileUrl", std::string())
579  ->setComment(
580  "Specify the file containing the site local config. Empty string will load from default directory.");
581  desc.addOptionalUntracked<std::string>("overrideSourceCacheTempDir");
582  desc.addOptionalUntracked<double>("overrideSourceCacheMinFree");
583  desc.addOptionalUntracked<std::string>("overrideSourceCacheHintDir");
584  desc.addOptionalUntracked<std::string>("overrideSourceCloneCacheHintDir")
585  ->setComment("Provide an alternate cache hint for fast cloning.");
586  desc.addOptionalUntracked<std::string>("overrideSourceReadHint");
587  desc.addOptionalUntracked<std::vector<std::string> >("overrideSourceNativeProtocols");
588  desc.addOptionalUntracked<unsigned int>("overrideSourceTTreeCacheSize");
589  desc.addOptionalUntracked<unsigned int>("overrideSourceTimeout");
590  desc.addOptionalUntracked<unsigned int>("debugLevel");
591  desc.addOptionalUntracked<bool>("overridePrefetching")
592  ->setComment("Request ROOT to asynchronously prefetch I/O during computation.");
593  desc.addOptionalUntracked<std::string>("overrideStatisticsDestination")
594  ->setComment(
595  "Provide an alternate network destination for I/O statistics (must be in the form of host:port).");
596  desc.addOptionalUntracked<std::vector<std::string> >("overrideStatisticsInfo")
597  ->setComment(
598  "Provide an alternate listing of statistics to send (comma separated list; current options are 'dn' or "
599  "'nodn'). If left blank, all information is snet (including DNs).");
600  desc.addOptionalUntracked<bool>("overrideUseLocalConnectString");
601  desc.addOptionalUntracked<std::string>("overrideLocalConnectPrefix");
602  desc.addOptionalUntracked<std::string>("overrideLocalConnectSuffix");
603  descriptions.add("SiteLocalConfigService", desc);
604  }

◆ frontierConnect()

std::string const edm::service::SiteLocalConfigService::frontierConnect ( std::string const &  servlet) const
private

Definition at line 220 of file SiteLocalConfigService.cc.

References Exception, m_connected, m_frontierConnect, m_url, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by lookupCalibConnect(), and parse().

220  {
221  if (!m_connected) {
222  throw cms::Exception("Incomplete configuration") << "Valid site-local-config not found at " << m_url;
223  }
224 
225  if (m_frontierConnect.empty()) {
226  throw cms::Exception("Incomplete configuration")
227  << "Did not find frontier-connect in calib-data section in " << m_url;
228  }
229 
230  if (servlet.empty()) {
231  return m_frontierConnect;
232  }
233 
234  // Replace the last component of every "serverurl=" piece (up to the
235  // next close-paren) with the servlet
236  std::string::size_type nextparen = 0;
237  std::string::size_type serverurl, lastslash;
238  std::string complexstr = "";
239  while ((serverurl = m_frontierConnect.find("(serverurl=", nextparen)) != std::string::npos) {
240  complexstr.append(m_frontierConnect, nextparen, serverurl - nextparen);
241  nextparen = m_frontierConnect.find(')', serverurl);
242  lastslash = m_frontierConnect.rfind('/', nextparen);
243  complexstr.append(m_frontierConnect, serverurl, lastslash - serverurl + 1);
244  complexstr.append(servlet);
245  }
246  complexstr.append(m_frontierConnect, nextparen, m_frontierConnect.length() - nextparen);
247 
248  return complexstr;
249  }
uint16_t size_type

◆ getCatalog()

void edm::service::SiteLocalConfigService::getCatalog ( tinyxml2::XMLElement const &  cat,
std::string  site,
std::string  subSite 
)
private

Definition at line 325 of file SiteLocalConfigService.cc.

References eostools::cat(), m_dataCatalogs, edm::CatalogAttributes::protocol, edm::CatalogAttributes::site, edm::CatalogAttributes::storageSite, AlCaHLTBitMon_QueryRunRegistry::string, edm::CatalogAttributes::subSite, and edm::CatalogAttributes::volume.

Referenced by parse().

325  {
326  edm::CatalogAttributes aCatalog;
327  aCatalog.site = site;
328  aCatalog.subSite = subSite;
329  auto tmp_site = std::string(safe(cat.Attribute("site")));
330  //no site attribute in the data catalog defined in <data-access>, so storage site is from <site> block of site_local_config.xml, which is the input parameter "site" of this method
331  if (tmp_site.empty())
332  aCatalog.storageSite = site;
333  //now storage site is explicitly defined in <data-access>
334  else
335  aCatalog.storageSite = tmp_site;
336  aCatalog.volume = std::string(safe(cat.Attribute("volume")));
337  aCatalog.protocol = std::string(safe(cat.Attribute("protocol")));
338  m_dataCatalogs.push_back(aCatalog);
339  }
std::vector< edm::CatalogAttributes > m_dataCatalogs
def cat(path)
Definition: eostools.py:401

◆ localConnectPrefix()

std::string const & edm::service::SiteLocalConfigService::localConnectPrefix ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 322 of file SiteLocalConfigService.cc.

References m_localConnectPrefix.

◆ localConnectSuffix()

std::string const & edm::service::SiteLocalConfigService::localConnectSuffix ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 323 of file SiteLocalConfigService.cc.

References m_localConnectSuffix.

◆ lookupCalibConnect()

std::string const edm::service::SiteLocalConfigService::lookupCalibConnect ( std::string const &  input) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 251 of file SiteLocalConfigService.cc.

References frontierConnect(), input, and AlCaHLTBitMon_QueryRunRegistry::string.

251  {
252  static std::string const proto = "frontier://";
253 
254  if (input.substr(0, proto.length()) == proto) {
255  // Replace the part after the frontier:// and before either an open-
256  // parentheses (which indicates user-supplied options) or the last
257  // slash (which indicates start of the schema) with the complex
258  // parenthesized string returned from frontierConnect() (which
259  // contains all the information needed to connect to frontier),
260  // if that part is a simple servlet name (non-empty and not
261  // containing special characters)
262  // Example connect strings where servlet is replaced:
263  // frontier://cms_conditions_data/CMS_COND_ECAL
264  // frontier://FrontierInt/CMS_COND_ECAL
265  // frontier://FrontierInt(retrieve-ziplevel=0)/CMS_COND_ECAL
266  // Example connect strings left untouched:
267  // frontier://cmsfrontier.cern.ch:8000/FrontierInt/CMS_COND_ECAL
268  // frontier://(serverurl=cmsfrontier.cern.ch:8000/FrontierInt)/CMS_COND_ECAL
269  std::string::size_type startservlet = proto.length();
270  // if user supplied extra parenthesized options, stop servlet there
271  std::string::size_type endservlet = input.find('(', startservlet);
272  if (endservlet == std::string::npos) {
273  endservlet = input.rfind('/', input.length());
274  }
275  std::string servlet = input.substr(startservlet, endservlet - startservlet);
276  if ((!servlet.empty()) && (servlet.find_first_of(":/)[]") == std::string::npos)) {
277  if (servlet == "cms_conditions_data") {
278  // use the default servlet from site-local-config.xml
279  servlet = "";
280  }
281  return proto + frontierConnect(servlet) + input.substr(endservlet);
282  }
283  }
284  return input;
285  }
uint16_t size_type
static std::string const input
Definition: EdmProvDump.cc:50
std::string const frontierConnect(std::string const &servlet) const

◆ parse()

void edm::service::SiteLocalConfigService::parse ( std::string const &  url)
private

Definition at line 341 of file SiteLocalConfigService.cc.

References cms::Exception::addContext(), getEcalConditions_orcoffint2r_cff::catalog, hcalRecHitTable_cff::doc, Exception, frontierConnect(), getCatalog(), m_cacheHint, m_cacheHintPtr, m_cacheMinFree, m_cacheMinFreePtr, m_cacheTempDir, m_cacheTempDirPtr, m_cloneCacheHint, m_cloneCacheHintPtr, m_connected, m_enablePrefetching, m_enablePrefetchingPtr, m_frontierConnect, m_localConnectPrefix, m_localConnectSuffix, m_nativeProtocols, m_nativeProtocolsPtr, m_readHint, m_readHintPtr, m_rfioType, m_siteName, m_statisticsDestination, m_statisticsInfo, m_statisticsInfoAvail, m_subSiteName, m_timeout, m_timeoutPtr, m_trivialDataCatalogs, m_ttreeCacheSize, m_ttreeCacheSizePtr, m_useLocalConnectString, submitPVValidationJobs::split(), AlCaHLTBitMon_QueryRunRegistry::string, and relmon_authenticated_wget::url.

Referenced by SiteLocalConfigService().

341  {
342  tinyxml2::XMLDocument doc;
343  auto loadErr = doc.LoadFile(url.c_str());
344  if (loadErr != tinyxml2::XML_SUCCESS) {
345  return;
346  }
347 
348  // The Site Config has the following format
349  // <site-local-config>
350  // <site name="FNAL">
351  // <subsite name="FNAL_SUBSITE"/>
352  // <event-data>
353  // <catalog url="trivialcatalog_file:/x/y/z.xml"/>
354  // <rfiotype value="castor"/>
355  // </event-data>
356  // <calib-data>
357  // <catalog url="trivialcatalog_file:/x/y/z.xml"/>
358  // <frontier-connect>
359  // ... frontier-interpreted server/proxy xml ...
360  // </frontier-connect>
361  // <local-connect>
362  // <connectString prefix="anything1" suffix="anything2"/>
363  // </local-connect>
364  // </calib-data>
365  // <source-config>
366  // <cache-temp-dir name="/a/b/c"/>
367  // <cache-hint value="..."/>
368  // <read-hint value="..."/>
369  // <ttree-cache-size value="0"/>
370  // <native-protocols>
371  // <protocol prefix="dcache"/>
372  // <protocol prefix="file"/>
373  // </native-protocols>
374  // </source-config>
375  // </site>
376  // </site-local-config>
377 
378  auto rootElement = doc.RootElement();
379 
380  for (auto site = rootElement->FirstChildElement("site"); site != nullptr;
381  site = site->NextSiblingElement("site")) {
382  auto subSite = site->FirstChildElement("subsite");
383 
384  // Parse the site name
385  m_siteName = safe(site->Attribute("name"));
387  if (subSite) {
388  //check to make sure subSite has no children
389  auto subSite_first_child = subSite->FirstChild();
390  if (subSite_first_child) {
391  cms::Exception ex("SiteLocalConfigService");
392  ex << "Invalid site-local-config.xml. Subsite node has children!";
393  ex.addContext("edm::SiteLocalConfigService::parse()");
394  throw ex;
395  }
396  m_subSiteName = safe(subSite->Attribute("name"));
397  }
398 
399  // Parsing of the event data section
400  auto eventData = site->FirstChildElement("event-data");
401  if (eventData) {
402  auto catalog = eventData->FirstChildElement("catalog");
403  if (catalog) {
404  m_trivialDataCatalogs.push_back(safe(catalog->Attribute("url")));
405  catalog = catalog->NextSiblingElement("catalog");
406  while (catalog) {
407  m_trivialDataCatalogs.push_back(safe(catalog->Attribute("url")));
408  catalog = catalog->NextSiblingElement("catalog");
409  }
410  }
411  auto rfiotype = eventData->FirstChildElement("rfiotype");
412  if (rfiotype) {
413  m_rfioType = safe(rfiotype->Attribute("value"));
414  }
415  }
416 
417  //data-access
418  //let store catalog entry as: SITE,SUBSITE,STORAGE_SITE,VOLUME,PROTOCOL
419  // SITE: from <site name= /> element
420  // SUBSITE: from <subsite name= /> element. SUBSITE=SITE for site
421  // STORAGE_SITE, VOLUME and PROTOCOL: from <catalog site= volume= protocol= /> in <data-access>. If "site" attribute is not defined inside <catalog />, STORAGE_SITE is SITE
422  //Therefore
423  //1. if STORAGE_SITE = SITE, use local storage.json since STORAGE_SITE is not a cross site
424  //2. if SUBSITE is empty, this is a site. Otherwise, this is a subsite. These are used to define the path to locate the storage.json in FileLocator. This path is provided by storageDescriptionPath() method of this class.
425  //get data-access
426  auto dataAccess = site->FirstChildElement("data-access");
427  if (dataAccess) {
428  //get catalogs
429  auto catalog = dataAccess->FirstChildElement("catalog");
430  if (catalog) {
431  //add all info for the first catlog here
433  //get next catlog
434  catalog = catalog->NextSiblingElement("catalog");
435  while (catalog) {
436  //add all info for the current catlog here
438  //get next catlog
439  catalog = catalog->NextSiblingElement("catalog");
440  }
441  }
442  }
443 
444  // Parsing of the calib-data section
445  auto calibData = site->FirstChildElement("calib-data");
446 
447  if (calibData) {
448  auto frontierConnect = calibData->FirstChildElement("frontier-connect");
449 
450  if (frontierConnect) {
451  m_frontierConnect = _toParenString(*frontierConnect);
452  }
453  auto localConnect = calibData->FirstChildElement("local-connect");
454  if (localConnect) {
455  if (frontierConnect) {
456  throw cms::Exception("Illegal site local configuration")
457  << "It is illegal to include both frontier-connect and local-connect in the same XML file";
458  }
460  auto connectString = localConnect->FirstChildElement("connectString");
461  if (connectString) {
462  m_localConnectPrefix = safe(connectString->Attribute("prefix"));
463  m_localConnectSuffix = safe(connectString->Attribute("suffix"));
464  }
465  }
466  }
467 
468  // Parsing of the source config section
469  auto sourceConfig = site->FirstChildElement("source-config");
470 
471  if (sourceConfig) {
472  auto cacheTempDir = sourceConfig->FirstChildElement("cache-temp-dir");
473 
474  if (cacheTempDir) {
475  m_cacheTempDir = safe(cacheTempDir->Attribute("name"));
477  }
478 
479  auto cacheMinFree = sourceConfig->FirstChildElement("cache-min-free");
480 
481  if (cacheMinFree) {
482  //TODO what did xerces do if it couldn't convert?
483  m_cacheMinFree = cacheMinFree->DoubleAttribute("value");
485  }
486 
487  auto cacheHint = sourceConfig->FirstChildElement("cache-hint");
488 
489  if (cacheHint) {
490  m_cacheHint = safe(cacheHint->Attribute("value"));
492  }
493 
494  auto cloneCacheHint = sourceConfig->FirstChildElement("clone-cache-hint");
495 
496  if (cloneCacheHint) {
497  m_cloneCacheHint = safe(cloneCacheHint->Attribute("value"));
499  }
500 
501  auto readHint = sourceConfig->FirstChildElement("read-hint");
502 
503  if (readHint) {
504  m_readHint = safe(readHint->Attribute("value"));
506  }
507 
508  auto ttreeCacheSize = sourceConfig->FirstChildElement("ttree-cache-size");
509 
510  if (ttreeCacheSize) {
511  m_ttreeCacheSize = ttreeCacheSize->UnsignedAttribute("value");
513  }
514 
515  auto timeout = sourceConfig->FirstChildElement("timeout-in-seconds");
516 
517  if (timeout) {
518  m_timeout = timeout->UnsignedAttribute("value");
520  }
521 
522  auto statsDest = sourceConfig->FirstChildElement("statistics-destination");
523 
524  if (statsDest) {
525  m_statisticsDestination = safe(statsDest->Attribute("endpoint"));
526  if (m_statisticsDestination.empty()) {
527  m_statisticsDestination = safe(statsDest->Attribute("name"));
528  }
529  std::string tmpStatisticsInfo = safe(statsDest->Attribute("info"));
530  boost::split(m_statisticsInfo, tmpStatisticsInfo, boost::is_any_of("\t ,"));
531  m_statisticsInfoAvail = !tmpStatisticsInfo.empty();
532  }
533 
534  auto prefetching = sourceConfig->FirstChildElement("prefetching");
535 
536  if (prefetching) {
537  m_enablePrefetching = prefetching->BoolAttribute("value");
539  }
540 
541  auto nativeProtocol = sourceConfig->FirstChildElement("native-protocols");
542 
543  if (nativeProtocol) {
544  for (auto child = nativeProtocol->FirstChildElement(); child != nullptr;
545  child = child->NextSiblingElement()) {
546  m_nativeProtocols.push_back(safe(child->Attribute("prefix")));
547  }
549  }
550  }
551  }
552  m_connected = true;
553  }
void getCatalog(tinyxml2::XMLElement const &cat, std::string site, std::string subSite)
std::vector< std::string > const * m_nativeProtocolsPtr
std::vector< std::string > m_trivialDataCatalogs
std::string const frontierConnect(std::string const &servlet) const
std::vector< std::string > m_nativeProtocols

◆ rfioType()

std::string const edm::service::SiteLocalConfigService::rfioType ( void  ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 287 of file SiteLocalConfigService.cc.

References m_rfioType.

◆ siteName()

std::string const & edm::service::SiteLocalConfigService::siteName ( void  ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 319 of file SiteLocalConfigService.cc.

References m_siteName.

◆ sourceCacheHint()

std::string const * edm::service::SiteLocalConfigService::sourceCacheHint ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 293 of file SiteLocalConfigService.cc.

References m_cacheHintPtr.

293 { return m_cacheHintPtr; }

◆ sourceCacheMinFree()

double const * edm::service::SiteLocalConfigService::sourceCacheMinFree ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 291 of file SiteLocalConfigService.cc.

References m_cacheMinFreePtr.

◆ sourceCacheTempDir()

std::string const * edm::service::SiteLocalConfigService::sourceCacheTempDir ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 289 of file SiteLocalConfigService.cc.

References m_cacheTempDirPtr.

289 { return m_cacheTempDirPtr; }

◆ sourceCloneCacheHint()

std::string const * edm::service::SiteLocalConfigService::sourceCloneCacheHint ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 295 of file SiteLocalConfigService.cc.

References m_cloneCacheHintPtr.

295 { return m_cloneCacheHintPtr; }

◆ sourceNativeProtocols()

std::vector< std::string > const * edm::service::SiteLocalConfigService::sourceNativeProtocols ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 309 of file SiteLocalConfigService.cc.

References m_nativeProtocolsPtr.

309  {
310  return m_nativeProtocolsPtr;
311  }
std::vector< std::string > const * m_nativeProtocolsPtr

◆ sourceReadHint()

std::string const * edm::service::SiteLocalConfigService::sourceReadHint ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 297 of file SiteLocalConfigService.cc.

References m_readHintPtr.

297 { return m_readHintPtr; }

◆ sourceTimeout()

unsigned int const * edm::service::SiteLocalConfigService::sourceTimeout ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 301 of file SiteLocalConfigService.cc.

References m_timeoutPtr.

301 { return m_timeoutPtr; }

◆ sourceTTreeCacheSize()

unsigned int const * edm::service::SiteLocalConfigService::sourceTTreeCacheSize ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 299 of file SiteLocalConfigService.cc.

References m_ttreeCacheSizePtr.

299 { return m_ttreeCacheSizePtr; }

◆ statisticsDestination()

struct addrinfo const * edm::service::SiteLocalConfigService::statisticsDestination ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 313 of file SiteLocalConfigService.cc.

References m_statisticsAddrInfo.

313 { return m_statisticsAddrInfo; }
edm::propagate_const< struct addrinfo * > m_statisticsAddrInfo

◆ statisticsInfo()

std::set< std::string > const * edm::service::SiteLocalConfigService::statisticsInfo ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 315 of file SiteLocalConfigService.cc.

References m_statisticsInfo, and m_statisticsInfoAvail.

◆ storageDescriptionPath()

std::filesystem::path const edm::service::SiteLocalConfigService::storageDescriptionPath ( edm::CatalogAttributes const &  aDataCatalog) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 186 of file SiteLocalConfigService.cc.

References cms::Exception::addContext(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, castor_dqm_sourceclient_file_cfg::path, edm::CatalogAttributes::site, edm::CatalogAttributes::storageSite, AlCaHLTBitMon_QueryRunRegistry::string, and edm::CatalogAttributes::subSite.

187  {
188  std::string siteconfig_path = std::string(std::getenv("SITECONFIG_PATH"));
189  std::filesystem::path filename_storage;
190  //not a cross site use local path given in SITECONFIG_PATH
191  if (aDataCatalog.site == aDataCatalog.storageSite) {
192  //it is a site (no defined subSite), use local path given in SITECONFIG_PATH
193  if (aDataCatalog.subSite.empty())
194  filename_storage = siteconfig_path;
195  //it is a subsite, move one level up
196  else
197  filename_storage = siteconfig_path + "/..";
198  } else { //cross site
199  //it is a site (no defined subSite), move one level up
200  if (aDataCatalog.subSite.empty())
201  filename_storage = siteconfig_path + "/../" + aDataCatalog.storageSite;
202  //it is a subsite, move two levels up
203  else
204  filename_storage = siteconfig_path + "/../../" + aDataCatalog.storageSite;
205  }
206  filename_storage /= "storage.json";
207  try {
208  filename_storage = std::filesystem::canonical(filename_storage);
209  } catch (std::exception &e) {
210  cms::Exception ex("SiteLocalConfigService");
211  ex << "Fail to convert path to the storage description, " << filename_storage.string()
212  << ", to the canonical absolute path"
213  << ". Path exists?";
214  ex.addContext("edm::SiteLocalConfigService::storageDescriptionPath()");
215  throw ex;
216  }
217  return filename_storage;
218  }

◆ subSiteName()

std::string const & edm::service::SiteLocalConfigService::subSiteName ( void  ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 320 of file SiteLocalConfigService.cc.

References m_subSiteName.

◆ trivialDataCatalogs()

std::vector< std::string > const & edm::service::SiteLocalConfigService::trivialDataCatalogs ( ) const
overridevirtual

Implements edm::SiteLocalConfig.

Definition at line 154 of file SiteLocalConfigService.cc.

References cms::Exception::addContext(), m_connected, m_trivialDataCatalogs, m_url, and createJobs::tmp.

154  {
155  if (!m_connected) {
156  static std::vector<std::string> const tmp{"file:PoolFileCatalog.xml"};
157  return tmp;
158  }
159 
160  if (m_trivialDataCatalogs.empty()) {
161  cms::Exception ex("SiteLocalConfigService");
162  ex << "Did not find catalogs in event-data section in " << m_url;
163  ex.addContext("edm::SiteLocalConfigService::trivialDataCatalogs()");
164  throw ex;
165  }
166 
167  return m_trivialDataCatalogs;
168  }
std::vector< std::string > m_trivialDataCatalogs
tmp
align.sh
Definition: createJobs.py:716

◆ useLocalConnectString()

bool edm::service::SiteLocalConfigService::useLocalConnectString ( ) const
overridevirtual

Member Data Documentation

◆ m_cacheHint

std::string edm::service::SiteLocalConfigService::m_cacheHint
private

Definition at line 83 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_cacheHintPtr

std::string const* edm::service::SiteLocalConfigService::m_cacheHintPtr
private

Definition at line 84 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceCacheHint().

◆ m_cacheMinFree

double edm::service::SiteLocalConfigService::m_cacheMinFree
private

Definition at line 81 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_cacheMinFreePtr

double const* edm::service::SiteLocalConfigService::m_cacheMinFreePtr
private

Definition at line 82 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceCacheMinFree().

◆ m_cacheTempDir

std::string edm::service::SiteLocalConfigService::m_cacheTempDir
private

Definition at line 79 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_cacheTempDirPtr

std::string const* edm::service::SiteLocalConfigService::m_cacheTempDirPtr
private

Definition at line 80 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceCacheTempDir().

◆ m_cloneCacheHint

std::string edm::service::SiteLocalConfigService::m_cloneCacheHint
private

Definition at line 85 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_cloneCacheHintPtr

std::string const* edm::service::SiteLocalConfigService::m_cloneCacheHintPtr
private

Definition at line 86 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceCloneCacheHint().

◆ m_connected

bool edm::service::SiteLocalConfigService::m_connected
private

Definition at line 78 of file SiteLocalConfigService.h.

Referenced by dataCatalogs(), frontierConnect(), parse(), and trivialDataCatalogs().

◆ m_dataCatalogs

std::vector<edm::CatalogAttributes> edm::service::SiteLocalConfigService::m_dataCatalogs
private

Definition at line 75 of file SiteLocalConfigService.h.

Referenced by dataCatalogs(), and getCatalog().

◆ m_debugLevel

unsigned int edm::service::SiteLocalConfigService::m_debugLevel
private

Definition at line 93 of file SiteLocalConfigService.h.

Referenced by debugLevel(), and SiteLocalConfigService().

◆ m_enablePrefetching

bool edm::service::SiteLocalConfigService::m_enablePrefetching
private

Definition at line 94 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_enablePrefetchingPtr

bool const* edm::service::SiteLocalConfigService::m_enablePrefetchingPtr
private

Definition at line 95 of file SiteLocalConfigService.h.

Referenced by enablePrefetching(), parse(), and SiteLocalConfigService().

◆ m_frontierConnect

std::string edm::service::SiteLocalConfigService::m_frontierConnect
private

Definition at line 76 of file SiteLocalConfigService.h.

Referenced by frontierConnect(), and parse().

◆ m_localConnectPrefix

std::string edm::service::SiteLocalConfigService::m_localConnectPrefix
private

Definition at line 106 of file SiteLocalConfigService.h.

Referenced by localConnectPrefix(), parse(), and SiteLocalConfigService().

◆ m_localConnectSuffix

std::string edm::service::SiteLocalConfigService::m_localConnectSuffix
private

Definition at line 107 of file SiteLocalConfigService.h.

Referenced by localConnectSuffix(), parse(), and SiteLocalConfigService().

◆ m_nativeProtocols

std::vector<std::string> edm::service::SiteLocalConfigService::m_nativeProtocols
private

Definition at line 96 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_nativeProtocolsPtr

std::vector<std::string> const* edm::service::SiteLocalConfigService::m_nativeProtocolsPtr
private

Definition at line 97 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceNativeProtocols().

◆ m_readHint

std::string edm::service::SiteLocalConfigService::m_readHint
private

Definition at line 87 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_readHintPtr

std::string const* edm::service::SiteLocalConfigService::m_readHintPtr
private

Definition at line 88 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceReadHint().

◆ m_rfioType

std::string edm::service::SiteLocalConfigService::m_rfioType
private

Definition at line 77 of file SiteLocalConfigService.h.

Referenced by parse(), and rfioType().

◆ m_siteName

std::string edm::service::SiteLocalConfigService::m_siteName
private

Definition at line 103 of file SiteLocalConfigService.h.

Referenced by parse(), and siteName().

◆ m_statisticsAddrInfo

edm::propagate_const<struct addrinfo*> edm::service::SiteLocalConfigService::m_statisticsAddrInfo
private

◆ m_statisticsDefaultPort

const std::string edm::service::SiteLocalConfigService::m_statisticsDefaultPort = "3334"
staticprivate

Definition at line 100 of file SiteLocalConfigService.h.

Referenced by computeStatisticsDestination().

◆ m_statisticsDestination

std::string edm::service::SiteLocalConfigService::m_statisticsDestination
private

◆ m_statisticsInfo

std::set<std::string> edm::service::SiteLocalConfigService::m_statisticsInfo
private

Definition at line 101 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and statisticsInfo().

◆ m_statisticsInfoAvail

bool edm::service::SiteLocalConfigService::m_statisticsInfoAvail
private

Definition at line 102 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and statisticsInfo().

◆ m_subSiteName

std::string edm::service::SiteLocalConfigService::m_subSiteName
private

Definition at line 104 of file SiteLocalConfigService.h.

Referenced by parse(), and subSiteName().

◆ m_timeout

unsigned int edm::service::SiteLocalConfigService::m_timeout
private

Definition at line 91 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_timeoutPtr

unsigned int const* edm::service::SiteLocalConfigService::m_timeoutPtr
private

Definition at line 92 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceTimeout().

◆ m_trivialDataCatalogs

std::vector<std::string> edm::service::SiteLocalConfigService::m_trivialDataCatalogs
private

Definition at line 74 of file SiteLocalConfigService.h.

Referenced by parse(), and trivialDataCatalogs().

◆ m_ttreeCacheSize

unsigned int edm::service::SiteLocalConfigService::m_ttreeCacheSize
private

Definition at line 89 of file SiteLocalConfigService.h.

Referenced by parse(), and SiteLocalConfigService().

◆ m_ttreeCacheSizePtr

unsigned int const* edm::service::SiteLocalConfigService::m_ttreeCacheSizePtr
private

Definition at line 90 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and sourceTTreeCacheSize().

◆ m_url

std::string edm::service::SiteLocalConfigService::m_url
private

◆ m_useLocalConnectString

bool edm::service::SiteLocalConfigService::m_useLocalConnectString = false
private

Definition at line 105 of file SiteLocalConfigService.h.

Referenced by parse(), SiteLocalConfigService(), and useLocalConnectString().