Skip to content

Commit acddca9

Browse files
expire: fix interaction with automatic retries
* Closes #6717
1 parent 1a3014b commit acddca9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

cylc/flow/task_pool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,7 @@ def clock_expire_tasks(self):
24402440
itask,
24412441
logging.WARNING,
24422442
TASK_OUTPUT_EXPIRED,
2443+
forced=True,
24432444
)
24442445

24452446
def task_succeeded(self, id_):

tests/integration/test_task_pool.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from cylc.flow.exceptions import WorkflowConfigError
4343
from cylc.flow.flow_mgr import FLOW_NONE
4444
from cylc.flow.id import TaskTokens, Tokens
45+
from cylc.flow.run_modes import RunMode
4546
from cylc.flow.task_events_mgr import TaskEventsManager
4647
from cylc.flow.task_outputs import (
4748
TASK_OUTPUT_FAILED,
@@ -2300,16 +2301,15 @@ async def test_expire_dequeue_with_retries(
23002301
conf = {
23012302
'scheduling': {
23022303
'initial cycle point': '2000',
2303-
23042304
'graph': {
23052305
'R1': 'foo'
23062306
},
23072307
},
23082308
'runtime': {
23092309
'foo': {
2310-
'execution retry delays': 'PT0S'
2311-
}
2312-
}
2310+
'execution retry delays': 'PT0S',
2311+
},
2312+
},
23132313
}
23142314

23152315
if expire_type == 'clock-expire':
@@ -2324,11 +2324,21 @@ async def test_expire_dequeue_with_retries(
23242324
)
23252325

23262326
id_ = flow(conf)
2327-
schd = scheduler(id_)
2327+
schd = scheduler(id_, run_mode='live')
23282328
schd: Scheduler
23292329
async with start(schd):
23302330
itask = schd.pool.get_tasks()[0]
23312331

2332+
# fake a real submission failure
2333+
# NOTE: yes, all of these things are needed for a valid test!
2334+
# Try removing the "force=True" added in this commit and ensure the
2335+
# "clock-expire" test fails before changing anything here!
2336+
itask.submit_num += 1
2337+
itask.run_mode = RunMode.LIVE
2338+
schd.task_job_mgr._set_retry_timers(itask, itask.tdef.rtconfig)
2339+
schd.task_events_mgr.process_message(itask, 0, 'failed')
2340+
schd.task_events_mgr._retry_task(itask, 0)
2341+
23322342
# the task should start as "waiting(queued)"
23332343
assert itask.state(TASK_STATUS_WAITING, is_queued=True)
23342344

0 commit comments

Comments
 (0)