-
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
parentless sequential clock trigger spawns #5732
parentless sequential clock trigger spawns #5732
Conversation
Actually, I might broaden this to optionally specify other xtriggers as
Because, for some workflows, I wouldn't want Even though you could add a clock-trigger to make them sequential, this would clutter the workflow definition and be too narrow (i.e. you may want them to run sequential but not bound by real time).. Wall clock xtriggers should still be sequential. |
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.
Had a good play around with this; it appears to do what it says on the tin 👍
Couple of comments...
@@ -211,6 +211,11 @@ def __init__( | |||
# Signatures of active functions (waiting on callback). | |||
self.active: list = [] | |||
|
|||
# Gather named wall-clocks closet to current time. |
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.
# Gather named wall-clocks closet to current time. | |
# Gather named wall-clock triggers closest to current time. |
@@ -211,6 +211,11 @@ def __init__( | |||
# Signatures of active functions (waiting on callback). | |||
self.active: list = [] | |||
|
|||
# Gather named wall-clocks closet to current time. | |||
# (no need to check or spawn future clocks of tasks respectively). |
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 you rephrase this comment? It doesn't seem to make much sense as worded!)
if housekeep_xtriggers: | ||
# Spawn parentless clock-triggered | ||
self.pool.spawn_parentless_clock_triggered() | ||
# (Could do this periodically?) | ||
self.xtrigger_mgr.housekeep(self.pool.get_tasks()) |
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.
Is this the right place to handle the spawning? The reason for the if
block here is to "delete satisfied xtriggers no longer needed by any tasks" (from the xtrigger_mgr.housekeep()
docstring).
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 noticed that housekeep_xtriggers
is satisfied if xtriggers are, so just piggy backed off that.. But could just use that spawns list.
# Gather named wall-clocks closet to current time. | ||
# (no need to check or spawn future clocks of tasks respectively). | ||
self.wall_clock_labels: set = set() | ||
self.wall_clock_spawns: list = [] |
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.
Could this variable be named better? like clock_spawn_next
or something?
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.
Yes, will change.. maybe to broaden sequential_spawn_next
My test case: [scheduling]
initial cycle point = now
[[xtriggers]]
c2 = "wall_clock(offset=PT1M)"
x1 = "xrandom(percent=50, _=%(point)s)"
[[graph]]
PT1M = """
@wall_clock => foo1
@c2 => foo2
@x1 => bar
qux
"""
[runtime]
[[foo1, foo2, bar, qux]]
script = sleep 5 One weird thing noticed. Spawned tasks waiting on clock triggers should be visible as waiting in |
Tested with a parent in one cycle too, all good. As above, with this additional bit of graph: R1/+PT2M/PT0M = "qux => foo2" |
Coverage passed, but we can't be verifying the new spawning behavior as you haven't modified any of the test files. |
Yes, I found the same.. Will have a look (maybe after next revision)
I guess what I mean is; the current tests appear to cover 100% of this patch.. But, yes, will need to add specific tests (especially with expanded to optionally other xtriggers) |
superseded by #5738 |
superseded by #5738
Spawning parentless clock triggered tasks out to the run ahead limit is unnecessary, and creates a lot of UI clutter.
Naturally clock trigger tasks are sequential in time, so it makes sense to only spawn the next parentless clock-trigger task when the current clock trigger is satisfied.
This PR attempts this.. In the simplest case;
cutting down this;
to this:
(would only show one cycle, but obviously the trigger is satisfied)
Real workflows often have a much greater chain than
a => b
(and possibly much greater run-ahead limits), so you can imagine the clutter. (such as those at NIWA)One thing to note; if your task has multiple xtriggers including a clock trigger, i.e.;
Then the task will still be clock blocked from spawning out to the RH (will instead spawn sequentially on trigger satisfaction, as described).
And if for some fringe reason a user wants the non-clock xtrigger to be checked/run out into the future/RH-limit and associated task clock bound to when it actually runs, then they can simply split them up:
(or w/e they desire.. alternatively turning their bespoke xtrigger into a task if that works)
In this way, I believe the behavior introduced here should be the default/natural restriction..
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users