Skip to content

Commit

Permalink
Sim mode: fix job number not incrementing on retry (cylc#6036)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim authored Mar 28, 2024
1 parent 9eabebb commit 6ba2f8c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes.d/6036.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed bug in simulation mode where repeated submissions were not displaying correctly in TUI/GUI.
2 changes: 1 addition & 1 deletion cylc/flow/task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ def _insert_task_job(
# And transient tasks, used for setting outputs and spawning children,
# do not submit jobs.
if (itask.tdef.run_mode == RunMode.SIMULATION) or forced:
job_conf = {"submit_num": 0}
job_conf = {"submit_num": itask.submit_num}
else:
job_conf = itask.jobs[-1]

Expand Down
34 changes: 34 additions & 0 deletions tests/integration/test_task_events_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,37 @@ async def test__reset_job_timers(
'polling intervals=PT25S,PT15S,PT10S,...'
in caplog.records[0].msg
)


async def test__insert_task_job(flow, one_conf, scheduler, start, validate):
"""Simulation mode tasks are inserted into the Data Store,
with correct submit number.
"""
conf = {
'scheduling': {'graph': {'R1': 'rhenas'}},
'runtime': {'rhenas': {'simulation': {
'fail cycle points': '1',
'fail try 1 only': False,
}}}}
id_ = flow(conf)
schd = scheduler(id_)
async with start(schd):
# Set task to running:
itask = schd.pool.get_tasks()[0]
itask.state.status = 'running'
itask.submit_num += 1

# Not run _insert_task_job yet:
assert not schd.data_store_mgr.added['jobs'].keys()

# Insert task (twice):
schd.task_events_mgr._insert_task_job(itask, 'now', 1)
itask.submit_num += 1
schd.task_events_mgr._insert_task_job(itask, 'now', 1)

# Check that there are two entries with correct submit
# numbers waiting for data-store insertion:
assert [
i.submit_num for i
in schd.data_store_mgr.added['jobs'].values()
] == [1, 2]

0 comments on commit 6ba2f8c

Please sign in to comment.