File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
webapp/src/Controller/API Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ function read_credentials(): void
6060 "waiting " => false ,
6161 "errorred " => false ,
6262 "last_attempt " => -1 ,
63+ "retrying " => false ,
6364 ];
6465 }
6566 if (count ($ endpoints ) <= 0 ) {
@@ -784,13 +785,22 @@ function fetch_executable_internal(
784785
785786 // We have gotten a work packet.
786787 $ endpoints [$ endpointID ]["waiting " ] = false ;
788+
787789 // All tasks are guaranteed to be of the same type.
788790 $ type = $ row [0 ]['type ' ];
791+
792+ if ($ type == 'try_again ' ) {
793+ if (!$ endpoints [$ endpointID ]['retrying ' ]) {
794+ logmsg (LOG_INFO , "API indicated to retry fetching work (this might take a while to clean up). " );
795+ }
796+ $ endpoints [$ endpointID ]['retrying ' ] = true ;
797+ continue ;
798+ }
799+ $ endpoints [$ endpointID ]['retrying ' ] = false ;
800+
789801 logmsg (LOG_INFO ,
790802 "⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ endpointID) " );
791803
792- $ jobId = $ row [0 ]['jobid ' ];
793-
794804 if ($ type == 'prefetch ' ) {
795805 if ($ lastWorkdir !== null ) {
796806 cleanup_judging ($ lastWorkdir );
Original file line number Diff line number Diff line change @@ -1595,7 +1595,12 @@ public function getJudgeTasksAction(Request $request): array
15951595 ->getQuery ()
15961596 ->getOneOrNullResult (AbstractQuery::HYDRATE_SINGLE_SCALAR );
15971597 $ judgetasks = $ this ->getJudgetasks ($ jobid , $ max_batchsize , $ judgehost );
1598- if ($ judgetasks !== null ) {
1598+ if (empty ($ judgetasks )) {
1599+ // Somehow we got ourselves in a situation that there was a queue task without remaining judge tasks.
1600+ // This should not happen, but if it does, we need to clean up. Each of the fetch-work calls will clean
1601+ // up one queue task. We need to signal to the judgehost that there might be more work to do.
1602+ $ judgetasks = [['type ' => 'try_again ' ]];
1603+ } else {
15991604 // Mark it as being worked on.
16001605 $ this ->em ->createQueryBuilder ()
16011606 ->update (QueueTask::class, 'qt ' )
You can’t perform that action at this time.
0 commit comments