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 setting module parameters from a dict or PSet #46067

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

Dr15Jones
Copy link
Contributor

PR description:

  • added update_ method to _Parameterizable to match behavior of dict.update
  • can now pass a dict or PSet to new module initialization syntax to match behavior of old syntax.

PR validation:

Code compiles. New unit tests pass. Ran the new initialization syntax using a PSet by hand and it worked.

Properly handle passing multiple dicts to a Parameterizeable
Added update_ method similar to dict.update
When using new syntax to create a module, can now pass a PSet or
dict in the same way as one could using the old syntax.
@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 19, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • FWCore/ParameterSet (core)

@Dr15Jones, @makortel, @smuzaffar can you please review it and eventually sign? Thanks.
@makortel, @missirol, @wddgit 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

@cmsbuild
Copy link
Contributor

-1

Failed Tests: UnitTests RelVals-INPUT
Size: This PR adds an extra 32KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-cd958c/41654/summary.html
COMMIT: e49d999
CMSSW: CMSSW_14_2_X_2024-09-19-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46067/41654/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-cd958c/41654/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-cd958c/41654/git-merge-result

Unit Tests

I found 1 errors in the following unit tests:

---> test test-das-selected-lumis had ERRORS

RelVals-INPUT

  • 2022.1010012022.101001_RunEGamma2022C_10k/step1_dasquery.log
  • 2023.0000012023.000001_RunMuonEG2023C_10k/step1_dasquery.log
  • 2023.0010012023.001001_RunDisplacedJet2023C_10k/step1_dasquery.log
Expand to see more relval errors ...
  • 2500.237
  • 2022.101001
  • 2023.000001
  • 2023.001001

Comparison Summary

Summary:

@Dr15Jones
Copy link
Contributor Author

The failures were all DAS which is unrelated to this PR

@Dr15Jones
Copy link
Contributor Author

please test

let's see if we can get a clean check.

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 32KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-cd958c/41662/summary.html
COMMIT: e49d999
CMSSW: CMSSW_14_2_X_2024-09-20-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46067/41662/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

@makortel
Copy link
Contributor

Comparison differences are related to #39803

Comment on lines 299 to 304
if isinstance(d,dict):
for k,v in d.items():
setattr(self, k, v)
else:
for k,v in d.parameters_().items():
setattr(self,k,v)
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

Suggested change
if isinstance(d,dict):
for k,v in d.items():
setattr(self, k, v)
else:
for k,v in d.parameters_().items():
setattr(self,k,v)
items = d.items() if isinstance(d, dict) else d.parameters_().items()
for k,v in items:
setattr(self, k, v)

?

a.update_(dict(a=3))
self.assertEqual(a.a.value(), 3)
a.update_(__PSet(a=__TestType(5)))
self.assertEqual(a.a.value(), 5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test case also for

            a.update_(dict(c=6))

? I'd expect it to raise an exception.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

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

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-cd958c/41713/summary.html
COMMIT: 235fbea
CMSSW: CMSSW_14_2_X_2024-09-23-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/46067/41713/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

@makortel
Copy link
Contributor

Comparison differences continue to be related to #39803

@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. @rappoccio, @sextonkennedy, @mandrenguyen, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 2ccff4f into cms-sw:master Sep 24, 2024
11 checks passed
@Dr15Jones Dr15Jones deleted the psetUpdate branch September 27, 2024 19:19
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.

4 participants