@@ -12,6 +12,7 @@ def handle_submission(
1212 download_terminated_log : bool = False ,
1313 download_finished_task : bool = False ,
1414 clean : bool = False ,
15+ reset_fail_count : bool = False ,
1516):
1617 """Handle terminated submission.
1718
@@ -25,13 +26,21 @@ def handle_submission(
2526 Download finished tasks.
2627 clean : bool, optional
2728 Clean submission.
29+ reset_fail_count : bool, optional
30+ Reset fail count of all jobs to zero.
2831
2932 Raises
3033 ------
3134 ValueError
3235 At least one action should be specified.
3336 """
34- if int (download_terminated_log ) + int (download_finished_task ) + int (clean ) == 0 :
37+ if (
38+ int (download_terminated_log )
39+ + int (download_finished_task )
40+ + int (clean )
41+ + int (reset_fail_count )
42+ == 0
43+ ):
3544 raise ValueError ("At least one action should be specified." )
3645
3746 submission_file = record .get_submission (submission_hash )
@@ -42,7 +51,18 @@ def handle_submission(
4251 # TODO: for unclear reason, the submission_hash may be changed
4352 submission .submission_hash = submission_hash
4453 submission .machine .context .bind_submission (submission )
54+ if reset_fail_count :
55+ for job in submission .belonging_jobs :
56+ job .fail_count = 0
57+ # save to remote and local
58+ submission .submission_to_json ()
59+ record .write (submission )
60+ if int (download_terminated_log ) + int (download_finished_task ) + int (clean ) == 0 :
61+ # if only reset_fail_count, no need to update submission state (expensive)
62+ return
4563 submission .update_submission_state ()
64+ submission .submission_to_json ()
65+ record .write (submission )
4666
4767 terminated_tasks = []
4868 finished_tasks = []
0 commit comments