-
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
flow merge for force-triggered n=0 (e.g. queued) tasks #6241
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Allow flow-merge when triggering n=0 tasks. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1387,6 +1387,7 @@ def spawn_on_output(self, itask, output, forced=False): | |
).relative_id | ||
|
||
c_task = self._get_task_by_id(c_taskid) | ||
in_pool = c_task is not None | ||
|
||
if c_task is not None and c_task != itask: | ||
# (Avoid self-suicide: A => !A) | ||
|
@@ -1411,10 +1412,12 @@ def spawn_on_output(self, itask, output, forced=False): | |
tasks.append(c_task) | ||
else: | ||
tasks = [c_task] | ||
|
||
for t in tasks: | ||
t.satisfy_me([itask.tokens.duplicate(task_sel=output)]) | ||
self.data_store_mgr.delta_task_prerequisite(t) | ||
self.add_to_pool(t) | ||
if not in_pool: | ||
self.add_to_pool(t) | ||
Comment on lines
-1417
to
+1420
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the add-to-pool bug. |
||
|
||
if t.point <= self.runahead_limit_point: | ||
self.rh_release_and_queue(t) | ||
|
@@ -2169,6 +2172,7 @@ def force_trigger_tasks( | |
if itask.state(TASK_STATUS_PREPARING, *TASK_STATUSES_ACTIVE): | ||
LOG.warning(f"[{itask}] ignoring trigger - already active") | ||
continue | ||
self.merge_flows(itask, flow_nums) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is all that was needed to trigger an existing |
||
self._force_trigger(itask) | ||
|
||
# Spawn and trigger future tasks. | ||
|
@@ -2471,7 +2475,7 @@ def merge_flows(self, itask: TaskProxy, flow_nums: 'FlowNums') -> None: | |
if not flow_nums or (flow_nums == itask.flow_nums): | ||
# Don't do anything if: | ||
# 1. merging from a no-flow task, or | ||
# 2. trying to spawn the same task in the same flow. This arises | ||
# 2. same flow (no merge needed); can arise | ||
# downstream of an AND trigger (if "A & B => C" | ||
# and A spawns C first, B will find C is already in the pool), | ||
# and via suicide triggers ("A =>!A": A tries to spawn itself). | ||
|
@@ -2480,6 +2484,8 @@ def merge_flows(self, itask: TaskProxy, flow_nums: 'FlowNums') -> None: | |
merge_with_no_flow = not itask.flow_nums | ||
|
||
itask.merge_flows(flow_nums) | ||
self.data_store_mgr.delta_task_flow_nums(itask) | ||
|
||
# Merged tasks get a new row in the db task_states table. | ||
self.db_add_new_flow_rows(itask) | ||
|
||
|
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.
There was no way to update flow_nums in the data_store.
We got away with this by (erroneously) re-adding flow-merged n=0 tasks to the task pool, which created an entirely new datastore task proxy.