From 2621415834ac7da2c14c3ed00618ee672322a23a Mon Sep 17 00:00:00 2001 From: Duong Date: Mon, 13 Mar 2023 20:38:43 -0500 Subject: [PATCH] implement Matti suggestions --- FWCore/Catalog/src/InputFileCatalog.cc | 45 ++++++++++++-------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/FWCore/Catalog/src/InputFileCatalog.cc b/FWCore/Catalog/src/InputFileCatalog.cc index cbbc9d7e08029..1f158af5a730f 100644 --- a/FWCore/Catalog/src/InputFileCatalog.cc +++ b/FWCore/Catalog/src/InputFileCatalog.cc @@ -57,12 +57,11 @@ namespace edm { throw ex; } - edm::CatalogAttributes inputOverride_struct( - 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 + edm::CatalogAttributes inputOverride_struct(tmps[0], //current-site + tmps[1], //current-subSite + tmps[2], //desired-data-access-site + tmps[3], //desired-data-access-volume + tmps[4]); //desired-data-access-protocol overrideFileLocator_ = std::make_unique(inputOverride_struct); // propagate_const has no reset() function @@ -87,18 +86,16 @@ namespace edm { fileLocators_trivalCatalog_.push_back(std::make_unique(*it)); } catch (cms::Exception const& e) { 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; - } + << "Caught an exception while constructing a file locator in InputFileCatalog::init: " << e.what() + << "Skip this catalog"; } } + if (fileLocators_trivalCatalog_.empty()) { + cms::Exception ex("FileCatalog"); + ex << "Unable to construct any 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()) @@ -109,18 +106,16 @@ namespace edm { fileLocators_.push_back(std::make_unique(*it)); } catch (cms::Exception const& e) { edm::LogWarning("InputFileCatalog") - << "Catch an exception while constructing a file locator in InputFileCatalog::init: " << e.what() + << "Caught 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; - } } } + if (fileLocators_.empty()) { + cms::Exception ex("FileCatalog"); + ex << "Unable to construct any file locator in InputFileCatalog::init"; + ex.addContext("Calling edm::InputFileCatalog::init()"); + throw ex; + } } else { cms::Exception ex("FileCatalog"); ex << "Undefined catalog type";