4242from cylc .flow .exceptions import WorkflowConfigError
4343from cylc .flow .flow_mgr import FLOW_NONE
4444from cylc .flow .id import TaskTokens , Tokens
45+ from cylc .flow .run_modes import RunMode
4546from cylc .flow .task_events_mgr import TaskEventsManager
4647from 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