Skip to content

Commit 1f0d336

Browse files
committed
test added
1 parent b72586a commit 1f0d336

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/integration/test_reload.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,74 @@ async def test_reload_global_platform_group(
308308
assert platform['meta']['x'] == '2'
309309

310310

311+
async def test_orphan_reload(
312+
flow,
313+
scheduler,
314+
start,
315+
log_filter,
316+
):
317+
"""Reload should not fail about orphaned tasks.
318+
319+
The following aspects of reload about orphans are tested:
320+
- Removal of both xtrigger and associated active/incomplete task.
321+
- Broadcast deltas generated after reload.
322+
"""
323+
before = {
324+
'scheduler': {
325+
'allow implicit tasks': True
326+
},
327+
'scheduling': {
328+
'initial cycle point': '20010101T0000Z',
329+
'graph': {
330+
'R1': '''
331+
foo => bar
332+
@wall_clock => bar
333+
'''
334+
}
335+
}
336+
}
337+
after = {
338+
'scheduler': {
339+
'allow implicit tasks': True
340+
},
341+
'scheduling': {
342+
'initial cycle point': '20010101T0000Z',
343+
'graph': {
344+
'R1': 'foo'
345+
}
346+
}
347+
}
348+
id_ = flow(before)
349+
schd = scheduler(id_)
350+
async with start(schd):
351+
# spawn in bar
352+
foo = schd.pool.get_tasks()[0]
353+
schd.pool.task_events_mgr.process_message(
354+
foo, '20010101T0000Z', 'succeeded')
355+
bar = schd.pool.get_tasks()[0]
356+
assert bar.identity == '20010101T0000Z/bar'
357+
# set bar to failed
358+
schd.pool.task_events_mgr.process_message(
359+
bar, '20010101T0000Z', 'failed')
360+
361+
# Save our progress
362+
schd.workflow_db_mgr.put_task_pool(schd.pool)
363+
364+
# Change workflow to one without bar and xtrigger
365+
flow(after, workflow_id=id_)
366+
367+
# reload the workflow
368+
await commands.run_cmd(commands.reload_workflow(schd))
369+
370+
# test broadcast delta over orphaned task
371+
schd.data_store_mgr.delta_broadcast()
372+
373+
# the reload should have completed successfully
374+
assert log_filter(
375+
contains=('Reload completed')
376+
)
377+
378+
311379
async def test_data_store_tproxy(flow, scheduler, start):
312380
"""Check N>0 task proxy in data store has correct info on reload.
313381

0 commit comments

Comments
 (0)