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
Fix some exceptions of cms.Modifier #16570
Fix some exceptions of cms.Modifier #16570
Conversation
@cmsbuild, please test |
A new Pull Request was created by @makortel (Matti Kortelainen) for CMSSW_8_1_X. It involves the following packages: FWCore/ParameterSet @cmsbuild, @smuzaffar, @Dr15Jones, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here #13028 |
_modifyParametersFromDict(params, self.__args, self._raiseUnknownKey) | ||
for k in self.__args.iterkeys(): | ||
if k in params: | ||
setattr(obj,k,params[k]) | ||
else: | ||
#the parameter must have been removed | ||
delattr(obj,k) | ||
@staticmethod | ||
def _raiseUnknownKey(key): |
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.
Other option would have been to add self
parameter, but since it would go unused I chose @staticmethod
.
@@ -1119,17 +1119,16 @@ def __call__(self,obj): | |||
for k in self.__args.iterkeys(): | |||
if hasattr(obj,k): | |||
params[k] = getattr(obj,k) | |||
else: | |||
params[k] = self.__args[k] |
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'm not 100 % sure if this is a correct fix. I first started to patch Mixins._modifyParametersFromDict()
to raise an exception if params[key]
does not have setValue
attribute. But after staring the code a bit I started to wonder why self.__args
is copied to params
here when Mixins._modifyParametersFromDict()
does effectively same thing.
Anyway, unit tests pass and (subset of) limited matrix workflows give exactly the same config dumps.
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'm guessing the copy was historic.
@cmsbuild, please test |
The tests are being triggered in jenkins. |
@@ -1119,17 +1119,16 @@ def __call__(self,obj): | |||
for k in self.__args.iterkeys(): | |||
if hasattr(obj,k): | |||
params[k] = getattr(obj,k) | |||
else: | |||
params[k] = self.__args[k] |
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'm guessing the copy was historic.
+1 |
This pull request is fully signed and it will be integrated in one of the next CMSSW_8_1_X IBs after it passes the integration tests. This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @smuzaffar |
@makortel thanks for the fix |
-1 Tested at: af4d95b You can see the results of the tests here: I found follow errors while testing this PR Failed tests: UnitTests
I found errors in the following unit tests: ---> test testJetMETCorrectionsType1MET had ERRORS |
Comparison job queued. |
Comparison is ready Alternative comparison was/were failed for workflow(s): |
The unit test failure was actually from a DAS failure.
|
While working on something else, I found out that when having a typo in the cms.Modifier parameters (i.e. trying to modify a non-existing parameter without an explicit type), the cms.Modifier machinery does not raise a helpful exception. This PR proposes fixes for those along unit tests (that demonstrate the "mistakes").
Without this PR, the first error case gives the following traceback
and the second the following
Tested in 8_1_0_pre16, no changes expected.