-
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
Config change.stop after cycle point #3883
Config change.stop after cycle point #3883
Conversation
cylc/flow/scheduler.py
Outdated
if ( | ||
not self.is_restart or | ||
not self.options.ignore_stopcp | ||
): | ||
if ( | ||
'stop after cycle point' in self.config.cfg['scheduling'] and | ||
self.options.stopcp is None | ||
): | ||
self.pool.set_stop_point(get_point( | ||
self.config.cfg['scheduling']['stop after cycle point'] | ||
)) | ||
self.options.stopcp = self.config.cfg['scheduling'][ | ||
'stop after cycle point' | ||
] | ||
if self.options.stopcp: | ||
self.pool.set_stop_point(get_point(self.options.stopcp)) |
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 this be simplified along the lines of:
if not self.options.stopcp:
# doesn't matter if stop after cycle point is None
self.options.stopcp = self.config.cfg['scheduling']['stop after cycle point']
if self.options.stopcp:
self.pool.set_stop_point(get_point(self.options.stopcp))
?
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.
Not really: Your suggestion would never allow the command line to over-ride the config: I'm not against tidying or commenting the logic though. It's a bit wierd.
Also, not having 'stop after cycle point' in self.config.cfg['scheduling']
would mean putting this in a try:/except:
in case the config item was blank(I mean, I could set a default, but that seems weird in this instance).
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.
Sources of stopcp by priority
- Command line
- Database
- Config
We can simplify the logic by creating a temporary variable to store our stopcp in, and only overwriting the self.options.stopcp at the end of the process.
We also need to check that --ignore-stop-after-cycle-point
works.
I wish that this were an easily unit-testable bit.
Test Cases
Command Line Set | Database Set | Config Set | How |
---|---|---|---|
✔️ | run or restart; check stopped correctly | ||
✔️ | ✔️ | run with config set; restart with command line set; check finished at CLI stop point | |
✔️ | ✔️ | run with CLI stop sooner than config; ensure has stopped at CLI stop point | |
✔️ | ✔️ | ✔️ | run with config set, stop with cylc stop ; restart with command line set |
✔️ | run with CLI, stop artificially; restart without CLI set; check flow stopped at stop point | ||
✔️ | run with config; check stopped at right place | ||
✔️ | ✔️ | run with stop point, stop with cylc stop in suite; sed mod the config stop point restart; check finish at db stop point | |
Not a test case |
Additionally we should test each of these cases with a restart with and without the --ignore-stop-cycle-point
cli option.
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.
Not really: Your suggestion would never allow the command line to over-ride the config
I think it would, the config value is only read if the CLI opt is not set.
462226c
to
7fba3cf
Compare
7fba3cf
to
a195573
Compare
|
||
def process_cylc_stop_point(self): |
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 would have thought a unit test for this method would be better suited than a functional test (quicker to run; we only need to test the logic in the method, otherwise the test corresponding to set_stop_point()
should handle the rest? (assuming such a test exists))
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 considered it, but because it's a method of the class it'd require some in un-fun mocking. However it'd be nicer, and I like the idea of working out how.
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 apart from question of unit vs functional test (up to you). However still needs a change log entry and maybe a cylc-doc PR?
I'm not sure about a cylc-doc PR. I have added some detail to the I don't think there is value in copying that somewhere else. I can't remember what was behind the inclusion of the What is the use-case for this config item @oliver-sanders? If I understood that I could probably do something in |
Don't think this needs adding to the user guide or anything. The best documentation would likely be to note the CLI opt referencing this config (and vice versa). |
- Update cylc/flow/cfgspec/suite.py [Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>] - added explanation of priority for stop-after-cycle-point to cli - fix review issues.
c8b6733
to
0c55c94
Compare
These changes close #3694 : Implement a
[scheduling]stop after cycle point
configuration to match thecylc run --stop-cycle-point=POINT
cli option.Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.