Skip to content

Commit 7c4af1c

Browse files
Merge pull request #6980 from MetRonnie/run-mode-bug
Data store: fix empty task proxy runtime field on reload
2 parents 6c07579 + fa2a126 commit 7c4af1c

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

changes.d/6980.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a bug where the GUI views would go blank when reloading a workflow.

cylc/flow/commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ async def reload_workflow(schd: 'Scheduler', reload_global: bool = False):
609609
schd.task_job_mgr.task_remote_mgr.remote_init_map.clear()
610610
schd.task_job_mgr.task_remote_mgr.is_reload = True
611611
schd.pool.reload(config)
612+
schd.data_store_mgr.apply_task_proxy_db_history()
612613
# Load jobs from DB
613614
schd.workflow_db_mgr.pri_dao.select_jobs_for_restart(
614615
schd.data_store_mgr.insert_db_job

cylc/flow/data_store_mgr.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def __init__(self, schd, n_edge_distance=1):
570570
self.n_window_completed_walks = set()
571571
self.n_window_depths = {}
572572
self.update_window_depths = False
573-
self.db_load_task_proxies = {}
573+
self.db_load_task_proxies: Dict[str, Tuple[TaskProxy, bool]] = {}
574574
self.family_pruned_ids = set()
575575
self.prune_trigger_nodes = {}
576576
self.prune_flagged_nodes = set()
@@ -1527,12 +1527,10 @@ def apply_task_proxy_db_history(self):
15271527
# added to an already-spawned task before restart.)
15281528

15291529
# Extract info from itasks to data-store.
1530-
for task_info in self.db_load_task_proxies.values():
1530+
for itask, _is_parent in self.db_load_task_proxies.values():
15311531
self._process_internal_task_proxy(
1532-
task_info[0],
1533-
self.added[TASK_PROXIES][
1534-
self.id_.duplicate(task_info[0].tokens).id
1535-
]
1532+
itask,
1533+
self.added[TASK_PROXIES][self.id_.duplicate(itask.tokens).id]
15361534
)
15371535

15381536
# Batch load jobs from DB.

tests/integration/test_reload.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
from contextlib import suppress
2020

2121
from cylc.flow import commands
22+
from cylc.flow.data_store_mgr import TASK_PROXIES
23+
from cylc.flow.scheduler import Scheduler
2224
from cylc.flow.task_state import (
2325
TASK_STATUS_WAITING,
2426
TASK_STATUS_PREPARING,
@@ -46,16 +48,7 @@ async def test_reload_waits_for_pending_tasks(
4648
See https://github.com/cylc/cylc-flow/issues/5107
4749
"""
4850
# a simple workflow with a single task
49-
id_ = flow({
50-
'scheduling': {
51-
'graph': {
52-
'R1': 'foo',
53-
},
54-
},
55-
'runtime': {
56-
'foo': {},
57-
},
58-
})
51+
id_ = flow('foo')
5952
schd = scheduler(id_, paused_start=False)
6053

6154
# we will artificially push the task through these states
@@ -270,7 +263,6 @@ async def test_reload_global_platform_group(
270263

271264
# Task using the platform group
272265
conf = {
273-
'scheduler': {'allow implicit tasks': True},
274266
'scheduling': {'graph': {'R1': 'one'}},
275267
'runtime': {
276268
'one': {
@@ -314,3 +306,23 @@ async def test_reload_global_platform_group(
314306
)
315307
platform = get_platform(rtconf)
316308
assert platform['meta']['x'] == '2'
309+
310+
311+
async def test_data_store_tproxy(flow, scheduler, start):
312+
"""Check N>0 task proxy in data store has correct info on reload.
313+
314+
https://github.com/cylc/cylc-flow/issues/6973
315+
"""
316+
schd: Scheduler = scheduler(flow('foo => bar'))
317+
318+
def get_ds_tproxy(task):
319+
return schd.data_store_mgr.data[schd.id][TASK_PROXIES][
320+
f'{schd.id}//1/{task}'
321+
]
322+
323+
async with start(schd):
324+
await schd.update_data_structure()
325+
assert str(get_ds_tproxy('bar').runtime)
326+
327+
await commands.run_cmd(commands.reload_workflow(schd))
328+
assert str(get_ds_tproxy('bar').runtime)

0 commit comments

Comments
 (0)