-
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
Move processing of stop cycle point to config.py #4827
Conversation
# ----------------------------------------------------------------------------- | ||
|
||
# Test that an invalid cycle point option does not cause an empty DB to be | ||
# created - https://github.com/cylc/cylc-flow/issues/4637 |
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.
This test is mostly nabbed from #4680
@@ -147,7 +147,6 @@ def get_option_parser(add_std_opts=False): | |||
"Set the final cycle point. " | |||
"This command line option overrides the workflow " | |||
"config option '[scheduling]final cycle point'. " | |||
"Use a value of 'reload' to reload from flow.cylc in a restart." |
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.
Removed this as it implies changes to flow.cylc will not be picked up normally. The true behaviour is too long-winded to explain here, see cylc/cylc-doc#459
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.
- Read
- Manually tested locally
There are a couple of Codecov holes. They aren't too bad IMO, but it would be nice if you could fix them.
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.
Looks good, yet to manually test start/restart/reload'ing the stop cycle manully but looks like you have done that extensively in the automated tests.
cylc/flow/cfgspec/workflow.py
Outdated
|
||
.. versionchanged:: 8.0.0 | ||
|
||
The deprecated ``[scheduling]max active cycle points`` setting |
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.
Unrelated, from user support yesterday this caused confusion making it look like "max active cycle points" is still deprecated.
The deprecated ``[scheduling]max active cycle points`` setting | |
The ``[scheduling]max active cycle points`` setting |
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.
But it is deprecated?
cylc-flow/cylc/flow/cfgspec/workflow.py
Lines 1709 to 1714 in 9ed6035
u.deprecate( | |
'8.0.0', | |
['scheduling', 'max active cycle points'], | |
['scheduling', 'runahead limit'], | |
cvtr=converter(lambda x: f'P{x}' if x != '' else '', '"n" -> "Pn"') | |
) |
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.
The setting is deprecated, however, the functionality is not.
# deprecated
max active cycle points = 4
# fine
runahead limit = P4
Because we had previously marked runahead limit
as deprecated this has caused some confusion.
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've tried to improve the wording of that notice
self.cfg['scheduling']['final cycle point'] is not None and | ||
not self.cfg['scheduling']['final cycle point'].strip() | ||
): | ||
if self.cfg['scheduling']['final cycle point'] == '': |
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.
The .strip()
may or may not have been helpful, if you're totally sure it wasn't needed that's fine, otherwise perhaps:
if self.cfg['scheduling']['final cycle point'] == '': | |
if not self.cfg['scheduling']['final cycle point'].strip(): |
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 tested out
final cycle point = " "
and put a breakpoint at this line; the value of self.cfg['scheduling']['final cycle point']
was just ''
. Presumably parsec handles stripping (as I would hope so)
|
||
|
||
@lru_cache(10000) | ||
def _point_parse(point_string): | ||
def _point_parse(point_string, _dump_fmt): |
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.
_dump_fmt
arg does nothing?
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.
It is needed for the caching to be valid, seeing as we rely on the WorkflowSpecifics.DUMP_FORMAT
inside the function. This is how it is done in isodatetime too: https://github.com/metomi/isodatetime/blob/abec7c8ff05ab19d06f5eda790422df54ca72a8b/metomi/isodatetime/data.py#L2174-L2184
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.
But this argument is not used within the function which makes it look like you can set this arg, which you cant.
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.
Dunno if _dump_fmt=WorkflowSpecifics.DUMP_FORMAT
would work with this mutable attribute?
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.
If my understanding is correct, dump_fmt=WorkflowSpecifics.DUMP_FORMAT
gets evaluated at time of function definition (when it is still None
), not at time of call, so that would not be helpful.
IMHO, it's a "private" (leading underscore) argument in a "private" function, so it's an acceptable solution for the time being
tests/unit/test_config.py
Outdated
# Need to check this as fcp treated as string by parsec, unlike | ||
# other cycle point settings |
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.
TODO?
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.
"Need to check this as" == "This test is needed because"
31692eb
to
66c913c
Compare
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.
Checked out and tested. No problems spotted with the implementation. Thanks @MetRonnie.
cylc/flow/config.py
Outdated
): | ||
if self.cfg['scheduling']['final cycle point'] == '': | ||
# (Unlike other cycle point settings in config, fcp is treated as | ||
# a string by parsec) |
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.
Worth saying why (here, as well in the cfgspec file):
# NOTE: final cycle point is not a V_CYCLE_POINT to allow expressions # such as '+P1Y' (relative to initial cycle point)
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.
Done
- remove potentially misleading line from cylc-play usage - clear up versionchanged notice for runahead limit/max active cycle points setting
These changes close:
--stopcp
on start "corrupts" database #4637Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
andconda-environment.yml
.--fcp
/--stopcp
cylc-doc#459