Skip to content

Commit

Permalink
Add integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Nov 8, 2024
1 parent 3dc13fb commit 087c0dc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cylc/flow/scripts/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 43 additions & 1 deletion tests/integration/scripts/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
get_option_parser,
)


DumpOptions = Options(get_option_parser())


Expand Down Expand Up @@ -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]',
]

0 comments on commit 087c0dc

Please sign in to comment.