Give a clean error for invalid initial cycle point syntax - #7401
Open
Sanjays2402 wants to merge 2 commits into
Open
Give a clean error for invalid initial cycle point syntax#7401Sanjays2402 wants to merge 2 commits into
Sanjays2402 wants to merge 2 commits into
Conversation
Some malformed cycle point values (e.g. "T, T") make the isodatetime parser fail with a bare "ValueError: too many values to unpack" rather than an ISO8601SyntaxError. _parse_iso_cycle_point only catches IsodatetimeError, so the ValueError escaped as a traceback instead of a WorkflowConfigError with a readable message. ingest_time now converts an unrecognised ValueError from the parser into an ISO8601SyntaxError, which the existing config error handling already reports cleanly. Adds a regression test covering the values reported in the issue.
hjoliver
self-requested a review
August 17, 2026 00:39
hjoliver
requested changes
Aug 17, 2026
Member
There was a problem hiding this comment.
@Sanjays2402 - thanks for this - your change looks good, but it doesn't fix the referenced issue because it needs to be done elsewhere in the code base as well.
Example, validation of this test workflow:
[scheduling]
initial cycle point = T, T
[[graph]]
R1 = foo
[runtime]
[[foo]]On this PR branch I get still get the traceback:
$ cylc val ./test/
Traceback (most recent call last):
File "/home/oliverh/cylc/cylc-flow/venv/bin/cylc", line 6, in <module>
sys.exit(main())
^^^^^^
File "/home/oliverh/cylc/cylc-flow/cylc/flow/scripts/cylc.py", line 651, in main
ret = _main(opts, cmd_args)
^^^^^^^^^^^^^^^^^^^^^
...<snip>...
File "/home/oliverh/cylc/cylc-flow/cylc/flow/parsec/validate.py", line 860, in coerce_cycle_point
TimePointParser().parse(value)
File "/home/oliverh/cylc/cylc-flow/venv/lib/python3.12/site-packages/metomi/isodatetime/parsers.py", line 240, in parse
date_info, time_info, parsed_expr = self.get_info(timepoint_string)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oliverh/cylc/cylc-flow/venv/lib/python3.12/site-packages/metomi/isodatetime/parsers.py", line 443, in get_info
date, time_time_zone = date_time_time_zone
^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7390
Some malformed
initial cycle pointvalues (e.g.T, T,T00, T18) make the isodatetime parser fail with a bareValueError: too many values to unpackinstead of anISO8601SyntaxError._parse_iso_cycle_pointonly catchesIsodatetimeError, so that escaped as a traceback rather than a cleanWorkflowConfigError.ingest_timenow converts an unrecognisedValueErrorfrom the parser into anISO8601SyntaxError, which the existing error handling already reports readably.Check List
CONTRIBUTING.mdand added my name as a Code Contributor.setup.cfg(andconda-environment.ymlif present).?.?.xbranch.