From 087c0dc59e0602895f3085f48a535e6e08fedb92 Mon Sep 17 00:00:00 2001 From: Hilary James Oliver Date: Fri, 8 Nov 2024 21:50:05 +1300 Subject: [PATCH] Add integration test. --- cylc/flow/scripts/dump.py | 2 +- tests/integration/scripts/test_dump.py | 44 +++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/cylc/flow/scripts/dump.py b/cylc/flow/scripts/dump.py index 59894280fa..f89d0d4aba 100755 --- a/cylc/flow/scripts/dump.py +++ b/cylc/flow/scripts/dump.py @@ -313,7 +313,7 @@ async def dump(workflow_id, options, write=print): if attrs: result += " (" + ",".join(attrs) + ")" if options.show_flows: - result += f" flows={item['flowNums']}" + result += f" flows={item['flowNums'].replace(' ','')}" write(result) except Exception as exc: diff --git a/tests/integration/scripts/test_dump.py b/tests/integration/scripts/test_dump.py index 65f91b1271..2dff651020 100644 --- a/tests/integration/scripts/test_dump.py +++ b/tests/integration/scripts/test_dump.py @@ -24,7 +24,6 @@ get_option_parser, ) - DumpOptions = Options(get_option_parser()) @@ -54,3 +53,46 @@ async def test_dump_tasks(flow, scheduler, start): write=ret.append ) assert ret == ['a, 1, waiting, not-held, queued, not-runahead'] + + +async def test_dump_format(flow, scheduler, start): + """Check the new "cylc dump" output format, i.e. task IDs. + + See: https://github.com/cylc/cylc-flow/pull/6440 + """ + id_ = flow({ + 'scheduler': { + 'allow implicit tasks': 'true', + }, + 'scheduling': { + 'graph': { + 'R1': 'a', + }, + }, + }) + schd = scheduler(id_) + async with start(schd): + [itask] = schd.pool.get_tasks() + + itask.state_reset(is_held=True) + schd.pool.data_store_mgr.delta_task_held(itask) + + itask.state_reset(is_runahead=True) + schd.pool.data_store_mgr.delta_task_runahead(itask) + + itask.state_reset(is_queued=True) + schd.pool.data_store_mgr.delta_task_queued(itask) + + itask.flow_nums = set([1,2]) + schd.pool.data_store_mgr.delta_task_flow_nums(itask) + + await schd.update_data_structure() + ret = [] + await dump( + id_, + DumpOptions(disp_form='tasks', show_flows=True), + write=ret.append + ) + assert ret == [ + '1/a:waiting (held,queued,runahead) flows=[1,2]', + ]