Skip to content
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

Merged
merged 1 commit into from Mar 16, 2023

Conversation

nhduongvn
Copy link
Contributor

@nhduongvn nhduongvn commented Mar 6, 2023

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

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 6, 2023

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34457

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 6, 2023

A new Pull Request was created by @nhduongvn for master.

It involves the following packages:

  • FWCore/Catalog (core)

@cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please review it and eventually sign? Thanks.
@makortel, @missirol, @wddgit this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

Comment on lines 61 to 65
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about reformatting along

Suggested change
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)

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<< "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();

Copy link
Contributor Author

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;
Copy link
Contributor

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

Suggested change
std::cout << "\n Skip this catalog" << std::endl;
edm::LogWarning("InputFileCatalog") << "\n Skip this catalog";

or not, i.e. something along

Suggested change
std::cout << "\n Skip this catalog" << std::endl;
LogDebug("InputFileCatalog") << "\n Skip this catalog";

?

Copy link
Contributor Author

@nhduongvn nhduongvn Mar 7, 2023

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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


I like your suggestion which makes things clearer. If all catalogs have errors fileLocators container is empty and the code throws an exception

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34613

  • This PR adds an extra 12KB to repository

@cmsbuild
Copy link
Contributor

Pull request #40961 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please check and sign again.

@makortel
Copy link
Contributor

@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) {
Copy link
Contributor

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

Suggested change
for (auto it = tmp_dataCatalogs.begin(); it != tmp_dataCatalogs.end(); ++it) {
for (auto const& catalog : tmp_dataCatalogs) {

@makortel
Copy link
Contributor

Could you also squash the commits into one, so that eventual backporting would be easier?

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-981e16/31285/summary.html
COMMIT: 2621415
CMSSW: CMSSW_13_1_X_2023-03-14-2300/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/40961/31285/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 4 lines to the logs
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3550756
  • DQMHistoTests: Total failures: 3
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3550731
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 213 log files, 164 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40961/34660

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

Pull request #40961 was updated. @cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please check and sign again.

@makortel
Copy link
Contributor

@cmsbuild, please test

Thanks!

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-981e16/31294/summary.html
COMMIT: da906d0
CMSSW: CMSSW_13_1_X_2023-03-14-2300/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/40961/31294/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 16 lines from the logs
  • Reco comparison results: 12 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3550756
  • DQMHistoTests: Total failures: 9
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3550725
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 213 log files, 164 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@makortel
Copy link
Contributor

+core

@cmsbuild
Copy link
Contributor

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)

@makortel
Copy link
Contributor

This PR should then be backported to 13_0_X and 12_6_X, right? (tagging also @stlammel)

@stlammel
Copy link

Yes, please, this should go into the backport too. - Stephan

@nhduongvn
Copy link
Contributor Author

Should I go ahead to prepare the pull requests for backporting or wait?

@perrotta
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit e3e8bd5 into cms-sw:master Mar 16, 2023
11 checks passed
@makortel
Copy link
Contributor

Should I go ahead to prepare the pull requests for backporting or wait?

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))

@makortel
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants