-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[Draft] esConsumes migration #35659
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
[Draft] esConsumes migration #35659
Conversation
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35659/25929
|
|
A new Pull Request was created by @hyunyong for master. It involves the following packages:
@cmsbuild, @malbouis, @tvami, @yuanchao, @francescobrivio can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
|
@makortel can you please help out with the error msg reported in the PR description? |
|
@cmsbuild , please test
|
|
-1 Failed Tests: Build ClangBuild BuildI found compilation error when building: >> Building edm plugin tmp/slc7_amd64_gcc900/src/Alignment/MuonAlignment/plugins/MuonGeometryArrange/libMuonGeometryArrange.so /cvmfs/cms-ib.cern.ch/nweek-02702/slc7_amd64_gcc900/external/gcc/9.3.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: tmp/slc7_amd64_gcc900/src/Alignment/MuonAlignment/plugins/MuonGeometryArrange/MuonGeometryArrange.cc.o: in function `MuonGeometryArrange::analyze(edm::Event const&, edm::EventSetup const&)': MuonGeometryArrange.cc:(.text+0x5eba): undefined reference to `MuonAlignmentInputXML::MuonAlignmentInputXML(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator >, edm::ConsumesCollector)' /cvmfs/cms-ib.cern.ch/nweek-02702/slc7_amd64_gcc900/external/gcc/9.3.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: MuonGeometryArrange.cc:(.text+0x5f4f): undefined reference to `MuonAlignmentInputXML::MuonAlignmentInputXML(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator >, edm::ConsumesCollector)' /cvmfs/cms-ib.cern.ch/nweek-02702/slc7_amd64_gcc900/external/gcc/9.3.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: MuonGeometryArrange.cc:(.text+0x5fe0): undefined reference to `MuonAlignmentInputXML::MuonAlignmentInputXML(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator >, edm::ConsumesCollector)' collect2: error: ld returned 1 exit status gmake: *** [tmp/slc7_amd64_gcc900/src/Alignment/MuonAlignment/plugins/MuonGeometryArrange/libMuonGeometryArrange.so] Error 1 Leaving library rule at src/Alignment/MuonAlignment/plugins Entering library rule at src/Alignment/MuonAlignment/plugins >> Compiling edm plugin /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/plugins/MuonGeometryDBConverter.cc >> Building edm plugin tmp/slc7_amd64_gcc900/src/Alignment/MuonAlignment/plugins/MuonGeometryDBConverter/libMuonGeometryDBConverter.so Clang BuildI found compilation error while trying to compile with clang. Command used: >> Compiling /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonAlignmentInputMethod.cc
>> Compiling /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonAlignmentInputSurveyDB.cc
>> Compiling /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonAlignmentOutputXML.cc
>> Compiling /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonAlignmentInputXML.cc
>> Compiling /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonScenarioBuilder.cc
/data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_12_1_X_2021-10-13-1100/src/Alignment/MuonAlignment/src/MuonAlignmentOutputXML.cc:42:25: error: out-of-line definition of 'MuonAlignmentOutputXML' does not match any declaration in 'MuonAlignmentOutputXML'
MuonAlignmentOutputXML::MuonAlignmentOutputXML(const edm::ParameterSet &iConfig)
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake: *** [tmp/slc7_amd64_gcc900/src/Alignment/MuonAlignment/src/AlignmentMuonAlignment/MuonAlignmentOutputXML.cc.o] Error 1
Entering library rule at src/Alignment/MuonAlignment/test
|
| class MuonAlignment { | ||
| public: | ||
| MuonAlignment(const edm::EventSetup& iSetup); | ||
| MuonAlignment(const edm::EventSetup& iSetup, edm::ConsumesCollector iC); |
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.
The problem lies here. As the error message says, all consumes declarations must be done in EDModule (or ESProducer) constructor, or in functions called from the constructor. Therefore, any function that takes EventSetup (not available at module construction time) and ConsumesCollector (not usable outside module construction time) will not work.
This implies that the code needs to be organized differently. Based on a quick look on how MuonAlignment is used, I'd look into moving the construction of MuonAlignment to the constructors of the EDModules, and passing in the EventSetup in a member function call instead of the constructor.
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.
@hyunyong any updates on this?
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.
@hyunyong any updates on this?
I'm testing and validating updates.
I will close this PR and make a new one.
|
|
||
| const edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeoToken_; | ||
|
|
||
| edm::ConsumesCollector m_cc; |
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.
Never make a copy of the ConsumesCollector
|
|
||
| DTSurveyConvert::DTSurveyConvert(const edm::ParameterSet &iConfig) : muonGeoToken_(esConsumes()) { | ||
| DTSurveyConvert::DTSurveyConvert(const edm::ParameterSet &iConfig) | ||
| : muonGeoToken_(esConsumes()), m_cc(consumesCollector()) { |
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.
Never copy a ConsumesCollector. It must be used in the constructors.
|
@hyunyong please also update the title to "Draft: esConsumes migration for the muon alignment modules" thanks |
|
-alca
|
|
I will make a new PR. |
|
I made a new PR #35719 |
PR description:
esConsumes migration for the muon alignment modules.
PR validation:
PR has an issue.
I try to use
consumesCollector()for Alignment/MuonAlignment/plugins/MuonGeometryDBConverter.cc (https://github.com/hyunyong/cmssw/blob/76328c9d2b24b0365d41fbff38ac6208e590e249/Alignment/MuonAlignment/plugins/MuonGeometryDBConverter.cc#L93)However, es tokens are initialized at https://github.com/hyunyong/cmssw/blob/76328c9d2b24b0365d41fbff38ac6208e590e249/Alignment/MuonAlignment/plugins/MuonGeometryDBConverter.cc#L168
I guess this is the reason why I got this issue.