-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Make sure to report an error if process.options.numberOfThreads has wrong type #41349
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-41349/35179
|
A new Pull Request was created by @makortel (Matti Kortelainen) for master. It involves the following packages:
@cmsbuild, @smuzaffar, @Dr15Jones, @makortel can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@cmsbuild, please test |
@Dr15Jones please review |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-501915/31985/summary.html Comparison SummarySummary:
|
|
||
process.maxEvents.input = 2 | ||
|
||
setattr(process.options, args.name, eval(str(args.value))) |
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.
Should we consider making the setting function more recursive? I.e. if it is already set with an 'optional' it enforces the type checking? I'm guessing we didn't do that initially as some older parts wanted to be able to declare different types. But if we made 'optional' smarter to know it could have different types, maybe we could handle that case as well.
In that way optional could always catch type problems at the python level.
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.
Even if we do what I suggest above, I think we should still do the check you are doing in the PR at the C++ level as well.
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.
I agree in being able to catch the problem already in python would be be better (at least for some patterns, I guess we can't do much for del process.options.numberOfThreads; process.options.numberOfThreads = cms.untracked.int64(3)
).
A technical complication for stronger enforcement is that the assignment
process.options.numberOfThreads = cms.untracked.int64(3)
executes code in the process.options
PSet. So the PSet.__setattr__()
would have to be made smarter (it looks doable though).
Another complication is that only one parameter in the process.options
PSet is optional
, and the others (including numberOfThreads
) have a default value set. So I think we'd need to think more how exactly to proceed.
All that sounds like a material for a new issue.
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.
I opened an issue #41356
+core |
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) |
+1 |
PR description:
Resolves #32070
PR validation:
FWCore/Framework
unit tests run.If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:
To be backported to all or some subset of "active release cycles".