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

Migrate to the new ref. based writeOneIOV() in Alignment package #35711

Closed

Conversation

yuanchao
Copy link
Contributor

PR description:

The new reference based method of the DBOutputService, writeOneIOV(), is introduced to keep the ownership of DB payload at the client side. The client will need to take care of the object memory. This PR migrates the old method, writeOne(), to writeOneIOV() in the following code:

  • Alignment/CommonAlignmentAlgorithm/plugins/SiPixelLorentzAngleCalibration.cc
  • Alignment/CommonAlignmentAlgorithm/plugins/SiStripBackplaneCalibration.cc
  • Alignment/CommonAlignmentAlgorithm/plugins/SiStripLorentzAngleCalibration.cc
  • Alignment/CommonAlignmentProducer/plugins/GlobalTrackerMuonAlignment.cc
  • Alignment/CommonAlignmentProducer/src/AlignmentProducerBase.cc
  • Alignment/LaserAlignment/plugins/LaserAlignment.cc
  • Alignment/MuonAlignment/plugins/MuonMisalignedProducer.cc
  • Alignment/MuonAlignment/src/MuonAlignment.cc
  • Alignment/OfflineValidation/plugins/TrackerGeometryCompare.cc
  • Alignment/SurveyAnalysis/plugins/SurveyDBUploader.cc
  • Alignment/SurveyAnalysis/plugins/SurveyInputTrackerFromDB.cc
  • Alignment/TrackerAlignment/plugins/MisalignedTrackerESProducer.cc
  • Alignment/TrackerAlignment/plugins/TrackerSystematicMisalignments.cc
  • Alignment/TrackerAlignment/src/TrackerAlignment.cc

** Please note that for payload objects created with 'new' function are not freed!

PR validation:

Code compiles.

if this PR is a backport please specify the original PR and why you need to backport that PR:

Not a backport and no backport is foreseen.

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35711/26019

  • This PR adds an extra 92KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

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

@@ -377,7 +377,7 @@ void SiStripBackplaneCalibration::endOfJob() {
if (saveToDB_) { // If requested, write out to DB
edm::Service<cond::service::PoolDBOutputService> dbService;
if (dbService.isAvailable()) {
dbService->writeOne(output, firstRunOfIOV, recordNameDBwrite_);
dbService->writeOneIOV(*output, firstRunOfIOV, recordNameDBwrite_);
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
dbService->writeOneIOV(*output, firstRunOfIOV, recordNameDBwrite_);
dbService->writeOneIOV(&output, firstRunOfIOV, recordNameDBwrite_);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

L333 SiStripBackPlaneCorrection *output = new SiStripBackPlaneCorrection;
Here output is a pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and we want to pass the reference to that pointer instead, as you write in the title of the PR. We can chat about this in our skype if you want @yuanchao

Copy link
Contributor Author

@yuanchao yuanchao Oct 18, 2021

Choose a reason for hiding this comment

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

@tvami Then "output" should be created as a normal instance of SiStripBackPlaneCorrection. And the rest of the code needs to be modify to cope with it. Or the client needs to delete this obj. somewhere later when no further usage. (ex. move L383 "delete output" out of the else{} before L387) That's what @GiacomoSguazzoni and I just discussed on skype. (in either cases, it can't be done easily with scripts)

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this piece of code is actually tested in unit test.
How can we make sure it's not broken by the updates?

Copy link
Contributor

Choose a reason for hiding this comment

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

the Call with *output is the one correct, but make sure the object is deleted at the end of its use. The method by reference (writeOnIOV) does not 'see' pointers, so it can't take care about the delete!

@tvami
Copy link
Contributor

tvami commented Oct 18, 2021

Hi @yuanchao I think you changed to the pointer many time when you should have kept the reference, no?

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35711/26024

  • This PR adds an extra 92KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @yuanchao (Yuan CHAO) for master.

It involves the following packages:

  • Alignment/CommonAlignmentAlgorithm (alca)
  • Alignment/CommonAlignmentProducer (alca)
  • Alignment/LaserAlignment (alca)
  • Alignment/MuonAlignment (alca)
  • Alignment/OfflineValidation (alca)
  • Alignment/SurveyAnalysis (alca)
  • Alignment/TrackerAlignment (alca)

@cmsbuild, @malbouis, @tvami, @yuanchao, @francescobrivio can you please review it and eventually sign? Thanks.
@pakhotin, @adewit, @abbiendi, @jhgoh, @tocheng, @tlampen, @mmusich, @trocino this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@yuanchao
Copy link
Contributor Author

@cmsbuild please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7367f9/19706/summary.html
COMMIT: 372e6a3
CMSSW: CMSSW_12_1_X_2021-10-17-2300/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/35711/19706/install.sh to create a dev area with all the needed externals and cmssw changes.

CMS StaticAnalyzer warnings: There are 11 EventSetupRecord::get warnings. See https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7367f9/19706/llvm-analysis/esrget-sa.txt for details.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 40
  • DQMHistoTests: Total histograms compared: 2751113
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2751084
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 39 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 170 log files, 37 edm output root files, 40 DQM output files
  • TriggerResults: no differences found

@tvami
Copy link
Contributor

tvami commented Oct 19, 2021

-alca

  • discussed privately that the PR is to be closed
  • we'll ask the subsystems to look at their files instead of a central migration (it also seems we'll have a bit of more time in 12_1_X, more info after ORP)

@perrotta
Copy link
Contributor

@yuanchao could you please close this PR, if that is the decision taken for it?

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.

8 participants