Skip to content

Refactor PathsAndConsumesOfModules #47937

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Dr15Jones
Copy link
Contributor

@Dr15Jones Dr15Jones commented Apr 23, 2025

PR description:

  • moved complex logic for creating the internal data structures to the class itself
  • can now ask an ESProducer what is produces
  • provide a mechanism to get minimal information about what ES products are being consumed

PR validation:

Framework unit tests pass.

resolves cms-sw/framework-team#1368

- moved complex logic for creating the internal data structures to the class itself
- can no ask an ESProducer what is produces
- provide a mechanism to get minimal information about what ES products are being consumed
@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 23, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47937/44595

ERROR: Build errors found during clang-tidy run.

  350 |                                module,
--
src/FWCore/Framework/interface/EDConsumerBase.h:349:13: error: invalid use of incomplete type 'ModuleConsumesInfo' [clang-diagnostic-error]
  349 |       iFunc(ModuleConsumesInfo(itInfo->m_type,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |                                module,
--
src/FWCore/Framework/interface/EDConsumerBase.h:349:13: error: invalid use of incomplete type 'ModuleConsumesInfo' [clang-diagnostic-error]
  349 |       iFunc(ModuleConsumesInfo(itInfo->m_type,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |                                module,
--
src/FWCore/Framework/interface/EDConsumerBase.h:349:13: error: invalid use of incomplete type 'ModuleConsumesInfo' [clang-diagnostic-error]
  349 |       iFunc(ModuleConsumesInfo(itInfo->m_type,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |                                module,
--
src/FWCore/Framework/interface/EDConsumerBase.h:349:13: error: invalid use of incomplete type 'ModuleConsumesInfo' [clang-diagnostic-error]
  349 |       iFunc(ModuleConsumesInfo(itInfo->m_type,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350 |                                module,
--
gmake: *** [config/SCRAM/GMake/Makefile.coderules:129: code-checks] Error 2
gmake: *** [There are compilation/build errors. Please see the detail log above.] Error 2

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47937/44596

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47937/44597

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • CondCore/CondHDF5ESSource (db)
  • CondCore/ESSources (db, alca)
  • FWCore/Framework (core)
  • FWCore/Integration (core)
  • FWCore/Services (core)
  • FWCore/TestProcessor (core)
  • PhysicsTools/CondLiteIO (analysis)

@Dr15Jones, @atpathak, @cmsbuild, @consuegs, @francescobrivio, @makortel, @perrotta, @smuzaffar, @tvami can you please review it and eventually sign? Thanks.
@JanChyczynski, @PonIlya, @fwyzard, @makortel, @missirol, @mmusich, @rsreds, @tocheng, @wddgit, @yuanchao this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor Author

please test

@Dr15Jones
Copy link
Contributor Author

Additional changes to PathsAndConsumesOfModules , probably for another PR

  • delay constructing many of the data structures until they are requested
  • further break the long functions into smaller ones, especially if the logic can be shared

@@ -236,4 +238,20 @@ CondHDF5ESSource::KeyedResolversVector CondHDF5ESSource::registerResolvers(Event
return returnValue;
}

std::vector<edm::eventsetup::ESModuleProducesInfo> CondHDF5ESSource::producesInfo() const {
std::vector<edm::eventsetup::ESModuleProducesInfo> returnValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would returnValue.reserve() be worth it? E.g. with records_.size()? (unlikely to be exact, but maybe would avoid a number of small reallocations)

@@ -648,6 +649,22 @@ edm::eventsetup::ESProductResolverProvider::KeyedResolversVector CondDBESSource:
return keyedResolversVector;
}

std::vector<edm::eventsetup::ESModuleProducesInfo> CondDBESSource::producesInfo() const {
std::vector<edm::eventsetup::ESModuleProducesInfo> returnValue;
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

  returnValue.reserve(m_resolvers.size());

?

Comment on lines +123 to +124
///This can only be called before the end of beginJob (after that the underlying data has been deleted)
std::vector<ModuleConsumesMinimalESInfo> moduleConsumesMinimalESInfos() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment here if the returned ModuleConsumesMinimalESInfo can be used beyond the end of beginJob would be helpful (given that ModuleConsumesMinimalESInfo holds string_view).

Comment on lines 91 to 92
assert(*consumedModuleLabel.data() !=
'\0'); // consumesMany used to create empty labels before we removed consumesMany
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
assert(*consumedModuleLabel.data() !=
'\0'); // consumesMany used to create empty labels before we removed consumesMany
// consumesMany used to create empty labels before we removed consumesMany
assert(*consumedModuleLabel.data() != '\0');

would look better

eventsetup::EventSetupProvider const& eventSetupProvider) {
esRecordsToProductResolverIndices_ = std::move(esRecordsToProductResolverIndices);
schedule_->fillESModuleAndConsumesInfo(esModulesWhoseProductsAreConsumedBy_, esRecordsToProductResolverIndices_);
namespace {} // namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

This can probably be removed?

Suggested change
namespace {} // namespace

@cmsbuild
Copy link
Contributor

-1

Failed Tests: ClangBuild
Size: This PR adds an extra 184KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-40a674/45690/summary.html
COMMIT: f1d9dc9
CMSSW: CMSSW_15_1_X_2025-04-23-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/47937/45690/install.sh to create a dev area with all the needed externals and cmssw changes.

The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic:

You can see more details here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-40a674/45690/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-40a674/45690/git-merge-result

Clang Build

I found compilation warning while trying to compile with clang. Command used:

USER_CUDA_FLAGS='--expt-relaxed-constexpr' USER_CXXFLAGS='-Wno-register -fsyntax-only' /usr/bin/time -v scram build -k -j 32 COMPILER='llvm compile'

See details on the summary page.

@Dr15Jones
Copy link
Contributor Author

Thinking more about this change, I'm not certain it would properly handle the case where multiple ES modules want to deliver the same data product.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47937/44608

@cmsbuild
Copy link
Contributor

Pull request #47937 was updated. @Dr15Jones, @atpathak, @cmsbuild, @consuegs, @francescobrivio, @makortel, @perrotta, @smuzaffar, @tvami can you please check and sign again.

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47937/44609

@cmsbuild
Copy link
Contributor

Pull request #47937 was updated. @Dr15Jones, @atpathak, @consuegs, @francescobrivio, @makortel, @perrotta, @smuzaffar, @tvami can you please check and sign again.

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 100KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-40a674/45707/summary.html
COMMIT: fd2c767
CMSSW: CMSSW_15_1_X_2025-04-24-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/47937/45707/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 2 lines to the logs
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 50
  • DQMHistoTests: Total histograms compared: 3913297
  • DQMHistoTests: Total failures: 17
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3913260
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 49 files compared)
  • Checked 215 log files, 184 edm output root files, 50 DQM output files
  • TriggerResults: no differences found

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.

Refactor EventSetup consumes information in PathsAndConsumesOfModules
3 participants