Skip to content

Commit 29d26cf

Browse files
authored
flow-nums data-store fix (#6115)
Replace flow nums for ghost tasks where necessary
1 parent ae6a70d commit 29d26cf

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

cylc/flow/data_store_mgr.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,9 @@ def increment_graph_window(
792792
source_tokens,
793793
point,
794794
flow_nums,
795-
False,
796-
itask
795+
is_parent=False,
796+
itask=itask,
797+
replace_existing=True,
797798
)
798799

799800
# Pre-populate from previous walks
@@ -1153,24 +1154,27 @@ def generate_ghost_task(
11531154
is_parent: bool = False,
11541155
itask: Optional['TaskProxy'] = None,
11551156
n_depth: int = 0,
1157+
replace_existing: bool = False,
11561158
) -> None:
11571159
"""Create task-point element populated with static data.
11581160
11591161
Args:
11601162
source_tokens
11611163
point
11621164
flow_nums
1163-
is_parent:
1164-
Used to determine whether to load DB state.
1165-
itask:
1166-
Update task-node from corresponding task proxy object.
1165+
is_parent: Used to determine whether to load DB state.
1166+
itask: Update task-node from corresponding task proxy object.
11671167
n_depth: n-window graph edge distance.
1168+
replace_existing: Replace any existing data for task as it may
1169+
be out of date (e.g. flow nums).
11681170
"""
11691171
tp_id = tokens.id
11701172
if (
11711173
tp_id in self.data[self.workflow_id][TASK_PROXIES]
11721174
or tp_id in self.added[TASK_PROXIES]
11731175
):
1176+
if replace_existing and itask is not None:
1177+
self.delta_from_task_proxy(itask)
11741178
return
11751179

11761180
name = tokens['task']
@@ -2525,6 +2529,26 @@ def delta_task_xtrigger(self, sig, satisfied):
25252529
xtrigger.time = update_time
25262530
self.updates_pending = True
25272531

2532+
def delta_from_task_proxy(self, itask: TaskProxy) -> None:
2533+
"""Create delta from existing pool task proxy.
2534+
2535+
Args:
2536+
itask (cylc.flow.task_proxy.TaskProxy):
2537+
Update task-node from corresponding task proxy
2538+
objects from the workflow task pool.
2539+
2540+
"""
2541+
tproxy: Optional[PbTaskProxy]
2542+
tp_id, tproxy = self.store_node_fetcher(itask.tokens)
2543+
if not tproxy:
2544+
return
2545+
update_time = time()
2546+
tp_delta = self.updated[TASK_PROXIES].setdefault(
2547+
tp_id, PbTaskProxy(id=tp_id))
2548+
tp_delta.stamp = f'{tp_id}@{update_time}'
2549+
self._process_internal_task_proxy(itask, tp_delta)
2550+
self.updates_pending = True
2551+
25282552
# -----------
25292553
# Job Deltas
25302554
# -----------

tests/functional/cylc-show/06-past-present-future.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TEST_NAME="${TEST_NAME_BASE}-show.present"
4646
contains_ok "${WORKFLOW_RUN_DIR}/show-c.txt" <<__END__
4747
state: running
4848
prerequisites: ('⨯': not satisfied)
49-
1/b succeeded
49+
1/b succeeded
5050
__END__
5151

5252
TEST_NAME="${TEST_NAME_BASE}-show.future"

0 commit comments

Comments
 (0)