Skip to content
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

Merged
merged 6 commits into from
May 3, 2022

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Apr 19, 2022

These changes close:

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg and conda-environment.yml.
  • Appropriate tests are included (unit, integration and functional!)
  • Appropriate change log entry included: c140476
  • Docs: Update docs for --fcp/--stopcp cylc-doc#459

@MetRonnie MetRonnie added the bug Something is wrong :( label Apr 19, 2022
@MetRonnie MetRonnie added this to the cylc-8.0rc4 milestone Apr 19, 2022
@MetRonnie MetRonnie self-assigned this Apr 19, 2022
# -----------------------------------------------------------------------------

# Test that an invalid cycle point option does not cause an empty DB to be
# created - https://github.com/cylc/cylc-flow/issues/4637
Copy link
Member Author

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."
Copy link
Member Author

@MetRonnie MetRonnie Apr 19, 2022

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

Copy link
Member

@wxtim wxtim left a 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.

Copy link
Member

@oliver-sanders oliver-sanders left a 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.


.. versionchanged:: 8.0.0

The deprecated ``[scheduling]max active cycle points`` setting
Copy link
Member

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.

Suggested change
The deprecated ``[scheduling]max active cycle points`` setting
The ``[scheduling]max active cycle points`` setting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is deprecated?

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"')
)

Copy link
Member

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.

Copy link
Member Author

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'] == '':
Copy link
Member

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:

Suggested change
if self.cfg['scheduling']['final cycle point'] == '':
if not self.cfg['scheduling']['final cycle point'].strip():

Copy link
Member Author

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):
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

@oliver-sanders oliver-sanders Apr 26, 2022

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.

Copy link
Member

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?

Copy link
Member Author

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

Comment on lines 476 to 477
# Need to check this as fcp treated as string by parsec, unlike
# other cycle point settings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO?

Copy link
Member Author

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"

@MetRonnie MetRonnie force-pushed the stopcp branch 2 times, most recently from 31692eb to 66c913c Compare April 26, 2022 12:27
Copy link
Contributor

@datamel datamel left a 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.

):
if self.cfg['scheduling']['final cycle point'] == '':
# (Unlike other cycle point settings in config, fcp is treated as
# a string by parsec)
Copy link
Member

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)

Copy link
Member Author

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
@MetRonnie MetRonnie requested a review from oliver-sanders May 3, 2022 12:52
@oliver-sanders oliver-sanders merged commit 36dfa25 into cylc:master May 3, 2022
@MetRonnie MetRonnie modified the milestones: cylc-8.0rc4, cylc-8.0rc3 May 3, 2022
@MetRonnie MetRonnie deleted the stopcp branch May 3, 2022 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
5 participants