@@ -305,6 +305,35 @@ def test_restore_open_job_more_submits(hq_env: HqEnv, tmp_path):
305305 wait_for_job_state (hq_env , 1 , "OPENED" )
306306
307307
308+ def test_restore_open_job_more_submits_counters (hq_env : HqEnv , tmp_path ):
309+ journal_path = os .path .join (tmp_path , "my.journal" )
310+
311+ hq_env .start_server (args = ["--journal" , journal_path ])
312+ w = hq_env .start_worker ()
313+ hq_env .command (["job" , "open" ])
314+ hq_env .command (["job" , "submit" , "--job=1" , "--array=0-1" , "--" , "uname" ])
315+ wait_for_task_state (hq_env , 1 , [0 , 1 ], ["finished" , "finished" ])
316+ hq_env .command (["worker" , "stop" , "1" ])
317+ wait_for_worker_state (hq_env , 1 , "STOPPED" , check_running_processes = False )
318+ hq_env .check_process_exited (w )
319+ for _ in range (2 ):
320+ hq_env .command (["job" , "submit" , "--job=1" , "--" , "uname" ])
321+
322+ expected = {"aborted" : 0 , "canceled" : 0 , "failed" : 0 , "finished" : 2 , "running" : 0 , "waiting" : 2 }
323+ out = hq_env .command (["--output-mode=json" , "job" , "info" , "1" ], as_json = True )
324+ assert out [0 ]["info" ]["task_stats" ] == expected
325+ hq_env .stop_server ()
326+
327+ hq_env .start_server (args = ["--journal" , journal_path ])
328+ out = hq_env .command (["--output-mode=json" , "job" , "info" , "1" ], as_json = True )
329+ assert out [0 ]["info" ]["task_stats" ] == expected
330+
331+ hq_env .start_worker ()
332+ wait_for_task_state (hq_env , 1 , [2 , 3 ], ["finished" , "finished" ])
333+ out = hq_env .command (["--output-mode=json" , "job" , "info" , "1" ], as_json = True )
334+ assert out [0 ]["info" ]["task_stats" ]["finished" ] == 4
335+
336+
308337def test_restore_streaming (hq_env : HqEnv , tmp_path ):
309338 journal_path = os .path .join (tmp_path , "my.journal" )
310339 stream_path = os .path .join (tmp_path , "stream" )
0 commit comments