-
Notifications
You must be signed in to change notification settings - Fork 94
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
parsec: catch section/option conflict in validation #5450
Conversation
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 think it's worth considering whether the integration test is ok.
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 happy with this -
I think it's big enough to be worth tagging @MetRonnie or @hjoliver (Who-ever gets there first) as second review.
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.
Tested out a few examples.
I think some items can be tripped up earlier by the deprecation upgrader. E.g.
# flow.cylc
scheduling = 22
File "~/cylc-flow-8.1/cylc/flow/scripts/validate.py", line 154, in wrapped_main
cfg = WorkflowConfig(
File "~/cylc-flow-8.1/cylc/flow/config.py", line 308, in __init__
self.pcfg = RawWorkflowConfig(
File "~/cylc-flow-8.1/cylc/flow/cfgspec/workflow.py", line 2042, in __init__
self.loadcfg(fpath, "workflow definition")
File "~/cylc-flow-8.1/cylc/flow/parsec/config.py", line 84, in loadcfg
self.upgrader(sparse, title)
File "~/cylc-flow-8.1/cylc/flow/cfgspec/workflow.py", line 1891, in upg
u.upgrade()
File "~/cylc-flow-8.1/cylc/flow/parsec/upgrade.py", line 200, in upgrade
old = self.get_item(upg['old'])
File "~/cylc-flow-8.1/cylc/flow/parsec/upgrade.py", line 107, in get_item
item = item[key]
TypeError: string indices must be integers
Also I noticed the opposite (using a setting as a section) gives traceback too, seems like a low priority though
# flow.cylc
[scheduling]
[[cycling mode]]
File "~/cylc-flow-8.1/cylc/flow/scripts/validate.py", line 154, in wrapped_main
cfg = WorkflowConfig(
File "~/cylc-flow-8.1/cylc/flow/config.py", line 308, in __init__
self.pcfg = RawWorkflowConfig(
File "~/cylc-flow-8.1/cylc/flow/cfgspec/workflow.py", line 2042, in __init__
self.loadcfg(fpath, "workflow definition")
File "~/cylc-flow-8.1/cylc/flow/parsec/config.py", line 86, in loadcfg
self.validate(sparse)
File "~/cylc-flow-8.1/cylc/flow/parsec/config.py", line 96, in validate
return self.validator(sparse, self.spec)
File "~/cylc-flow-8.1/cylc/flow/parsec/validate.py", line 1130, in cylc_config_validate
return CylcConfigValidator().validate(cfg_root, spec_root)
File "~/cylc-flow-8.1/cylc/flow/parsec/validate.py", line 216, in validate
cfg[key] = self.coercers[specval.vdr](value, keys + [key])
File "~/cylc-flow-8.1/cylc/flow/parsec/validate.py", line 389, in coerce_str
value = cls.strip_and_unquote(keys, value)
File "~/cylc-flow-8.1/cylc/flow/parsec/validate.py", line 528, in strip_and_unquote
if value.startswith(substr):
AttributeError: 'OrderedDictWithDefaults' object has no attribute 'startswith'
Will haver a quick look to see what can be done for those cases. |
a01fb7f
to
cb20237
Compare
@MetRonnie, I've expanded this PR to cover the two additional cases you found. |
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.
Can't find a way to produce traceback anymore. Worst thing I could find was
# flow.cylc
[scheduling]
[[max active cycle points]]
$ cylc validate Mist
WARNING - deprecated items were automatically upgraded in "workflow definition"
WARNING - * (8.0.0) [scheduling]max active cycle points -> [scheduling]runahead limit - "n" -> "Pn"
WorkflowConfigError: bad runahead limit "POrderedDictWithDefaults()" for integer cycling type
But I think this is very niche and not worth addressing
Just deconflicted CHANGES.md
One test failure - being dealt with elsewhere and unrelated to this pr |
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.