-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle invalid entries in <data-access> of site-local-config.xml #40961
Handle invalid entries in <data-access> of site-local-config.xml #40961
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34457
|
A new Pull Request was created by @nhduongvn for master. It involves the following packages:
@cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about reformatting along
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 | |
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 |
? (using named constants instead of a number + comment would be even better)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
try { | ||
fileLocators_trivalCatalog_.push_back(std::make_unique<FileLocator>(*it)); | ||
} catch (cms::Exception const& e) { | ||
continue; | ||
edm::LogWarning("InputFileCatalog") | ||
<< "Catch an exception while constructing a file locator in InputFileCatalog::init: " << e.what(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<< "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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be printed always, i.e. be
std::cout << "\n Skip this catalog" << std::endl; | |
edm::LogWarning("InputFileCatalog") << "\n Skip this catalog"; |
or not, i.e. something along
std::cout << "\n Skip this catalog" << std::endl; | |
LogDebug("InputFileCatalog") << "\n Skip this catalog"; |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogWarning is better since there is nothing wrong with the code but problem comes from invalid configuration in
cms::Exception ex("FileCatalog"); | ||
ex << "Can not construct a file locator in InputFileCatalog::init"; | ||
ex.addContext("Calling edm::InputFileCatalog::init()"); | ||
throw ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about organizing the loop along
for (auto const& cat : tmp_dataCatalogs) {
try {
fileLocators_trivalCatalog_.push_back(std::make_unique<FileLocator>(cat));
} catch (cms::Exception const& e) {
edm::LogWarning...;
}
}
if (fileLocators_trivalCatalog_.empty()) {
cms::Exception ex("FileCatalog");
ex << "Unable to construct any file locators in InputFileCatalog::init";
ex.addContext("Calling edm::InputFileCatalog::init()");
throw ex;
}
?
Actually I think the currently this PR would throw if and only if the last catalog has errors, whereas my understanding of the intention would be to throw only if all the catalogs had errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes your understanding is correct: if all catalogs had errors the code should stop and throw an exception. This is done by continue
statement
continue; |
I like your suggestion which makes things clearer. If all catalogs have errors
fileLocators
container is empty and the code throws an exception
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34613
|
Pull request #40961 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please check and sign again. |
@cmsbuild, please test |
|
||
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this loop (and the similar loop below) could become range-for along
for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) { | |
for (auto const& catalog : tmp_dataCatalogs) { |
Could you also squash the commits into one, so that eventual backporting would be easier? |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-981e16/31285/summary.html Comparison SummarySummary:
|
2621415
to
da906d0
Compare
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34660
|
Pull request #40961 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please check and sign again. |
@cmsbuild, please test Thanks! |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-981e16/31294/summary.html Comparison SummarySummary:
|
+core |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
This PR should then be backported to 13_0_X and 12_6_X, right? (tagging also @stlammel) |
Yes, please, this should go into the backport too. - Stephan |
Should I go ahead to prepare the pull requests for backporting or wait? |
+1 |
I'd say please prepare the backports to 13_0_X and 12_6_X (and for further beyond the fix should be combined with the backport of #37278 along the other fixes listed in #37278 (comment)) |
@nhduongvn Thanks for the backport to 12_5_X in #41309 . I think though that backporting this PR to 13_0_X and 12_6_X would be more impactful. |
PR description:
In the previous implementation, when the first entry in <data-access> of site-local-config.xml contains invalid information such as protocol name an exception is thrown out from InputFileCatalog::init() and no further data catalogs are constructed from other entries in <data-access>. This pull request fixes this. All entries are tried and if no one is valid, the execution stops. Moreover, there are some improvements in exception messages for more readable (double quote added ...).