Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function read_credentials(): void
"waiting" => false,
"errorred" => false,
"last_attempt" => -1,
"retrying" => false,
];
}
if (count($endpoints) <= 0) {
Expand Down Expand Up @@ -784,8 +785,19 @@ function fetch_executable_internal(

// We have gotten a work packet.
$endpoints[$endpointID]["waiting"] = false;

// All tasks are guaranteed to be of the same type.
$type = $row[0]['type'];

if ($type == 'try_again') {
if (!$endpoints[$endpointID]['retrying']) {
logmsg(LOG_INFO, "API indicated to retry fetching work (this might take a while to clean up).");
}
$endpoints[$endpointID]['retrying'] = true;
continue;
}
$endpoints[$endpointID]['retrying'] = false;

logmsg(LOG_INFO,
"⇝ Received " . sizeof($row) . " '" . $type . "' judge tasks (endpoint $endpointID)");

Expand Down
10 changes: 9 additions & 1 deletion webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1594,8 +1594,16 @@ public function getJudgeTasksAction(Request $request): array
->setMaxResults(1)
->getQuery()
->getOneOrNullResult(AbstractQuery::HYDRATE_SINGLE_SCALAR);
if ($jobid === null) {
return;
}
$judgetasks = $this->getJudgetasks($jobid, $max_batchsize, $judgehost);
if ($judgetasks !== null) {
if (empty($judgetasks)) {
// Somehow we got ourselves in a situation that there was a queue task without remaining judge tasks.
// This should not happen, but if it does, we need to clean up. Each of the fetch-work calls will clean
// up one queue task. We need to signal to the judgehost that there might be more work to do.
$judgetasks = [['type' => 'try_again']];
} else {
// Mark it as being worked on.
$this->em->createQueryBuilder()
->update(QueueTask::class, 'qt')
Expand Down
Loading