diff --git a/FWCore/Catalog/src/FileLocator.cc b/FWCore/Catalog/src/FileLocator.cc index ca7e3ea7ea94e..b22acebe754eb 100644 --- a/FWCore/Catalog/src/FileLocator.cc +++ b/FWCore/Catalog/src/FileLocator.cc @@ -268,8 +268,8 @@ namespace edm { //let enforce that site-local-config.xml and storage.json contains valid catalogs in , in which site defined in site-local-config.xml should be found in storage.json if (found_site == json.end()) { cms::Exception ex("FileCatalog"); - ex << "Can not find site and volume " << aCatalog.site << ", " << aCatalog.volume << " in " << filename_storage - << ". Check site-local-config.xml and storage.json"; + ex << "Can not find storage site \"" << aCatalog.storageSite << "\" and volume \"" << aCatalog.volume + << "\" in storage.json. Check site-local-config.xml and storage.json"; ex.addContext("edm::FileLocator:init()"); throw ex; } @@ -283,8 +283,9 @@ namespace edm { //let enforce that site-local-config.xml and storage.json contains valid catalogs, in which protocol defined in site-local-config.xml should be found in storage.json if (found_protocol == protocols.end()) { cms::Exception ex("FileCatalog"); - ex << "Can not find protocol " << aCatalog.protocol - << " in storage.json. Check site-local-config.xml and storage.json"; + ex << "Can not find protocol \"" << aCatalog.protocol << "\" for the storage site \"" << aCatalog.storageSite + << "\" and volume \"" << aCatalog.volume + << "\" in storage.json. Check site-local-config.xml and storage.json"; ex.addContext("edm::FileLocator:init()"); throw ex; } diff --git a/FWCore/Catalog/src/InputFileCatalog.cc b/FWCore/Catalog/src/InputFileCatalog.cc index 26b51d7504240..cbbc9d7e08029 100644 --- a/FWCore/Catalog/src/InputFileCatalog.cc +++ b/FWCore/Catalog/src/InputFileCatalog.cc @@ -9,6 +9,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include @@ -57,7 +58,11 @@ namespace edm { } edm::CatalogAttributes inputOverride_struct( - tmps[0], tmps[1], tmps[2], tmps[3], tmps[4]); //site, subSite,storageSite,volume,protocol + tmps[0], + tmps[1], + tmps[2], + tmps[3], + tmps[4]); //current-site,current-subSite,desired-data-access-site,desired-data-access-volume,desired-data-access-protocol overrideFileLocator_ = std::make_unique(inputOverride_struct); // propagate_const has no reset() function @@ -76,28 +81,44 @@ namespace edm { std::vector const& tmp_dataCatalogs = localconfservice->trivialDataCatalogs(); if (!fileLocators_trivalCatalog_.empty()) fileLocators_trivalCatalog_.clear(); - - //require the first file locator to success so obvious mistakes in data catalogs, typos for example, can be catched early. Note that tmp_dataCatalogs is not empty at this point. The protection is done inside the trivialDataCatalogs() of SiteLocalConfigService - fileLocators_trivalCatalog_.push_back(std::make_unique(tmp_dataCatalogs.front())); - - for (auto it = tmp_dataCatalogs.begin() + 1; it != tmp_dataCatalogs.end(); ++it) { + //Construct all file locators from data catalogs. If a data catalog is invalid (wrong protocol for example), it is skipped and no file locator is constructed (an exception is thrown out from FileLocator::init). + for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) { try { fileLocators_trivalCatalog_.push_back(std::make_unique(*it)); } catch (cms::Exception const& e) { - continue; + edm::LogWarning("InputFileCatalog") + << "Catch an exception while constructing a file locator in InputFileCatalog::init: " << e.what(); + if (it != tmp_dataCatalogs.end() - 1) { + std::cout << "\n Skip this catalog" << std::endl; + continue; + } else { + cms::Exception ex("FileCatalog"); + ex << "Can not construct a file locator in InputFileCatalog::init"; + ex.addContext("Calling edm::InputFileCatalog::init()"); + throw ex; + } } } } else if (catType == edm::CatalogType::RucioCatalog) { std::vector const& tmp_dataCatalogs = localconfservice->dataCatalogs(); if (!fileLocators_.empty()) fileLocators_.clear(); - //require the first file locator to success so obvious mistakes in data catalogs, typos for example, can be catched early. Note that tmp_dataCatalogs is not empty at this point. The protection is done inside the dataCatalogs() of SiteLocalConfigService - fileLocators_.push_back(std::make_unique(tmp_dataCatalogs.front())); - for (auto it = tmp_dataCatalogs.begin() + 1; it != tmp_dataCatalogs.end(); ++it) { + //Construct all file locators from data catalogs. If a data catalog is invalid (wrong protocol for example), it is skipped and no file locator is constructed (an exception is thrown out from FileLocator::init). + for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) { try { fileLocators_.push_back(std::make_unique(*it)); } catch (cms::Exception const& e) { - continue; + edm::LogWarning("InputFileCatalog") + << "Catch an exception while constructing a file locator in InputFileCatalog::init: " << e.what() + << "Skip this catalog"; + if (it != tmp_dataCatalogs.end() - 1) { + continue; + } else { + cms::Exception ex("FileCatalog"); + ex << "Can not construct a file locator in InputFileCatalog::init"; + ex.addContext("Calling edm::InputFileCatalog::init()"); + throw ex; + } } } } else {