-
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
Fix prerequisite and output manipulation on state changes. #2600
Conversation
A remaining problem in the same vein: on restart we now load the outputs of each task from the run DB, but we still infer the state of prerequisites from the task state (e.g. if a task with state >= "submitted" must have all prerequisites met... which is not true: it could have conditional prerequisites or have been manually triggered). So - @cylc/core - IMO we need a prerequisites table in the run DB - if agreed, I'll post a new issue for this. |
I agree - as long as it does not make it harder to implement #2329 in the future. |
Yeah, perhaps this should wait on #2329 in that case - I'll just add a note to that issue. |
Isn't it possible to somehow restore prerequisite state based on the task outputs loaded from the DB? I worry that adding prerequisite table in DB would just create more possibilities for prerequisites and actual task states to diverge (more places in the code to keep in sync) and will likely become superfluous once #2329 gets done. Perhaps it's better to focus energy on #2329, which addresses the problem at its source. |
I have a few thoughts (which may be misguided - I've tried to get my head around the matter & related issues but with limited experience I don't claim to fully understand the technicalities):
If I've evidently completely misunderstood something please just say; at least I can get clarification :) |
[deleted two of my own comments after some rethinking] |
That should be possible in principle, but I'm not sure how easy it would be, and conditional prerequisites completed after a task triggered would muddy the waters somewhat (c.f. your stated goal of wanting to know which prerequisites actually caused the task to trigger). Best to revisit after #2329 I think. |
|
3311ea8
to
a530b2c
Compare
[updated PR description] |
f63362f
to
3260103
Compare
@TomekTrzeciak - I tried to assign you as a second reviewer on this, since it's closely tied to your PR, however I think I need to invite you to be a member of the "cylc" group to do that (just done). |
if output not in [TASK_OUTPUT_EXPIRED, | ||
TASK_OUTPUT_SUBMIT_FAILED, | ||
TASK_OUTPUT_FAILED]: | ||
msg += "\n " + output |
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.
Note on this branch tasks retain these "alternate standard outputs" permanently (but normally in the non-completed state). They were being added and removed on the fly, which was messy, just to avoid this log message on normal successful task completion.
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 probably adds a tiny amount to the memory footprint, but it is the right thing to do IMO.
lib/cylc/task_pool.py
Outdated
if status in [TASK_STATUS_FAILED, | ||
TASK_STATUS_SUBMIT_FAILED]: | ||
# TODO - HUH? SUBMIT_FAILED? WHAT ABOUT SUCCEEDED? | ||
itask.set_event_time('finished', |
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 looks suspicious, indeed. Needs some more explanation if this is correct.
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.
Should probably include all states in cylc.task_state.TASK_STATUSES_FINAL
.
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.
(oops, looks like I forgot to come back to my own reminder there!)
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.
Fixed. Turns out set_event_time
merely updates the state summary times shown in the GUI - nothing to do with "events" as such. So I've changed the method name, and only update the "finished" time for succeeded and failed tasks.
@@ -398,7 +390,7 @@ def _set_state(self, status): | |||
message += " (%s)" % self.hold_swap | |||
LOG.debug(message, itask=self.identity) | |||
|
|||
def is_greater_than(self, status): | |||
def is_gt(self, status): |
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.
Why status_leq
and status_geq
are module functions, while this is a method?
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.
Well, the latter concerns where self.status
(of a task state object) lies in the ordered list of status strings, whereas the former concerns the relative position of two bare status strings. Some minor refactoring could probably get rid of one or the other, but I don't think it particularly matters.
af49813
to
35bdbe5
Compare
(branch rebased) |
@sadielbartholomew please sanity check this one. |
Sanity test in progress. Not related to the essence of this PR, but while conducting testing it emerged that I have a significant amount of 'bad' suites sitting in my 'cylc-run' directory (the Rose Bush migration PR being to blame) as per the comments in the two |
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 to me: sensible approach to the issue & the implementation seems sound. Please consider my referenced but essentially off-topic PR (which could be taken separately to this one if more convenient).
…r-bad-dirs Pre-empt local 'registration' test failure by 'Errno 2'
Merging (two approvals, and @sadielbartholomew's side-PR only affects a couple of tests). |
Close #2599
Address a problem first revealed in #2561 (no one had tried to use task prerequisites for external purposes until now, I guess).
Principally, at certain task state changes prerequisites were being set to all-met or all-not-met. This was at best unnecessary and at worst wrong: in conditional triggers, or manual triggering, tasks can submit without all prerequisites being met.
On this branch:
Also:
ready
(this state is really a detail of internal implementation - users should usecylc trigger
) andheld
(users should usecylc hold
, which properly handles swap states)See more detailed comments in
TaskState.reset_state()
and thebin/cylc-reset
usage string.Tests based on #2599 (comment)