Skip to content

Commit

Permalink
Fix simulation mode submit num bug (#6362)
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie authored Oct 2, 2024
1 parent 1eda3a7 commit 372e01e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes.d/6362.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed simulation mode bug where the task submit number would not increment
5 changes: 3 additions & 2 deletions cylc/flow/workflow_db_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,15 @@ def put_update_task_state(self, itask):
"status": itask.state.status,
"flow_wait": itask.flow_wait,
"is_manual_submit": itask.is_manual_submit,
"submit_num": itask.submit_num,
}
# Note tasks_states table rows are for latest submit_num only
# (not one row per submit).
where_args = {
"cycle": str(itask.point),
"name": itask.tdef.name,
"flow_nums": serialise_set(itask.flow_nums),
}
# Note tasks_states table rows are for latest submit_num only
# (not one row per submit).
self.db_updates_map.setdefault(self.TABLE_TASK_STATES, [])
self.db_updates_map[self.TABLE_TASK_STATES].append(
(set_args, where_args))
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from pathlib import Path

import pytest
from pytest import param

from cylc.flow import commands
from cylc.flow.cycling.iso8601 import ISO8601Point
from cylc.flow.scheduler import Scheduler
from cylc.flow.simulation import sim_time_check


Expand Down Expand Up @@ -443,3 +445,15 @@ async def test_settings_broadcast(
assert itask.try_timers['execution-retry'].delays == [2.0, 2.0, 2.0]
# n.b. rtconfig should remain unchanged, lest we cancel broadcasts:
assert itask.tdef.rtconfig['execution retry delays'] == [5.0, 5.0]


async def test_db_submit_num(
flow, one_conf, scheduler, run, complete, db_select
):
"""Test simulation mode correctly increments the submit_num in the DB."""
schd: Scheduler = scheduler(flow(one_conf), paused_start=False)
async with run(schd):
await complete(schd, '1/one')
assert db_select(schd, False, 'task_states', 'submit_num', 'status') == [
(1, 'succeeded'),
]

0 comments on commit 372e01e

Please sign in to comment.