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 557 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().

557  {
558  std::vector<std::string> inputStrings;
559  boost::split(inputStrings, m_statisticsDestination, boost::is_any_of(":"));
560  const std::string &host = inputStrings[0];
561  const std::string &port = (inputStrings.size() > 1) ? inputStrings[1] : m_statisticsDefaultPort;
562  struct addrinfo *res;
563  struct addrinfo hints;
564  memset(&hints, '\0', sizeof(hints));
565  hints.ai_socktype = SOCK_DGRAM;
566  hints.ai_flags = AI_ADDRCONFIG;
567  hints.ai_family = AF_UNSPEC;
568  int e = getaddrinfo(host.c_str(), port.c_str(), &hints, &res);
569  if (e != 0) {
570  // Silent failure - there's no way to report non-fatal failures from here.
571  return;
572  }
574  }
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 576 of file SiteLocalConfigService.cc.

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

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

◆ 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 327 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().

327  {
328  edm::CatalogAttributes aCatalog;
329  aCatalog.site = site;
330  aCatalog.subSite = subSite;
331  auto tmp_site = std::string(safe(cat.Attribute("site")));
332  //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
333  if (tmp_site.empty())
334  aCatalog.storageSite = site;
335  //now storage site is explicitly defined in <data-access>
336  else
337  aCatalog.storageSite = tmp_site;
338  aCatalog.volume = std::string(safe(cat.Attribute("volume")));
339  aCatalog.protocol = std::string(safe(cat.Attribute("protocol")));
340  m_dataCatalogs.push_back(aCatalog);
341  }
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 324 of file SiteLocalConfigService.cc.

References m_localConnectPrefix.

◆ localConnectSuffix()

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

Implements edm::SiteLocalConfig.

Definition at line 325 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 343 of file SiteLocalConfigService.cc.

References cms::Exception::addContext(), getEcalConditions_orcoffint2r_cff::catalog, boostedTaus_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().

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