diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index a25a229df7..b2ab57385b 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -1380,8 +1380,9 @@ function judge(array $judgeTask): bool } } - $hardtimelimit = $run_config['time_limit'] + - overshoot_time($run_config['time_limit'], $overshoot); + $hardtimelimit = $run_config['time_limit'] + + overshoot_time($run_config['time_limit'], $overshoot) + + $run_config['overshoot']; if ($combined_run_compare) { // This accounts for wall time spent in the validator. We may likely // want to make this configurable in the future. The current factor is diff --git a/webapp/src/Controller/API/JudgehostController.php b/webapp/src/Controller/API/JudgehostController.php index 21856eb082..b118a2e39a 100644 --- a/webapp/src/Controller/API/JudgehostController.php +++ b/webapp/src/Controller/API/JudgehostController.php @@ -1159,7 +1159,7 @@ private function maybeUpdateActiveJudging(Judging $judging): void ->getResult(); // TODO: Pick up priority from previous judgings? $this->rejudgingService->createRejudging($rejudging->getReason(), JudgeTask::PRIORITY_DEFAULT, $judgings, - false, $rejudging->getRepeat(), $rejudging->getRepeatedRejudging(), $skipped); + false, $rejudging->getRepeat(), 0, $rejudging->getRepeatedRejudging(), $skipped); } } } diff --git a/webapp/src/Controller/Jury/InternalErrorController.php b/webapp/src/Controller/Jury/InternalErrorController.php index 7f78c8ecaa..bfd3a3a585 100644 --- a/webapp/src/Controller/Jury/InternalErrorController.php +++ b/webapp/src/Controller/Jury/InternalErrorController.php @@ -187,6 +187,7 @@ public function handleAction(Request $request, ?Profiler $profiler, int $errorId $affectedJudgings->getValues(), false, 0, + 0, null, $skipped, $progressReporter); diff --git a/webapp/src/Controller/Jury/RejudgingController.php b/webapp/src/Controller/Jury/RejudgingController.php index f9a185bc5a..517a773d88 100644 --- a/webapp/src/Controller/Jury/RejudgingController.php +++ b/webapp/src/Controller/Jury/RejudgingController.php @@ -526,6 +526,7 @@ public function addAction(Request $request, FormFactoryInterface $formFactory): 'before' => $formData['before'], 'after' => $formData['after'], 'referer' => $request->headers->get('referer'), + 'overshoot' => $formData['overshoot'], ]; return $this->render('jury/rejudging_add.html.twig', [ 'data' => http_build_query($data), @@ -639,7 +640,7 @@ public function addAction(Request $request, FormFactoryInterface $formFactory): $skipped = []; $res = $this->rejudgingService->createRejudging( - $reason, (int)$data['priority'], $judgings, false, (int)($data['repeat'] ?? 1), null, $skipped, $progressReporter); + $reason, (int)$data['priority'], $judgings, false, (int)($data['repeat'] ?? 1), (int) ($data['overshoot'] ?? 0), null, $skipped, $progressReporter); $this->generateFlashMessagesForSkippedJudgings($skipped); if ($res === null) { @@ -670,6 +671,7 @@ public function createAction(Request $request): Response $autoApply = (bool)$request->request->get('auto_apply'); $repeat = (int)$request->request->get('repeat'); $priority = $request->request->get('priority') ?: 'default'; + $overshoot = (int)$request->request->get('overshoot') ?: 0; if (empty($table) || empty($id)) { throw new BadRequestHttpException('No table or id passed for selection in rejudging'); @@ -723,7 +725,7 @@ public function createAction(Request $request): Response flush(); }; - return $this->streamResponse($this->requestStack, function () use ($priority, $progressReporter, $repeat, $reason, $request, $autoApply, $includeAll, $id, $table, $tablemap) { + return $this->streamResponse($this->requestStack, function () use ($priority, $progressReporter, $repeat, $reason, $overshoot, $request, $autoApply, $includeAll, $id, $table, $tablemap) { // Only rejudge submissions in active contests. $contests = $this->dj->getCurrentContests(); @@ -773,7 +775,7 @@ public function createAction(Request $request): Response } $skipped = []; - $res = $this->rejudgingService->createRejudging($reason, JudgeTask::parsePriority($priority), $judgings, $autoApply, $repeat, null, $skipped, $progressReporter); + $res = $this->rejudgingService->createRejudging($reason, JudgeTask::parsePriority($priority), $judgings, $autoApply, $repeat, $overshoot, null, $skipped, $progressReporter); if ($res === null) { $prefix = sprintf('%s%s', $request->getSchemeAndHttpHost(), $request->getBasePath()); diff --git a/webapp/src/Form/Type/RejudgingType.php b/webapp/src/Form/Type/RejudgingType.php index e6bd5cdbaa..9e2966311a 100644 --- a/webapp/src/Form/Type/RejudgingType.php +++ b/webapp/src/Form/Type/RejudgingType.php @@ -132,6 +132,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'constraints' => $relativeTimeConstraints, 'help' => 'in form ±[HHH]H:MM[:SS[.uuuuuu]], contest relative time', ]); + $builder->add('overshoot', IntegerType::class, [ + 'label' => 'Additional grace time', + 'required' => false, + 'attr' => ['min' => 0, 'max' => 999], + 'help' => 'in seconds', + ]); $builder->add('save', SubmitType::class); diff --git a/webapp/src/Service/DOMJudgeService.php b/webapp/src/Service/DOMJudgeService.php index c3f983d897..55c1bcbc39 100644 --- a/webapp/src/Service/DOMJudgeService.php +++ b/webapp/src/Service/DOMJudgeService.php @@ -1168,7 +1168,7 @@ public function unblockJudgeTasks(): void } } - public function maybeCreateJudgeTasks(Judging $judging, int $priority = JudgeTask::PRIORITY_DEFAULT, bool $manualRequest = false): void + public function maybeCreateJudgeTasks(Judging $judging, int $priority = JudgeTask::PRIORITY_DEFAULT, bool $manualRequest = false, int $overshoot = 0): void { $submission = $judging->getSubmission(); $problem = $submission->getContestProblem(); @@ -1181,7 +1181,7 @@ public function maybeCreateJudgeTasks(Judging $judging, int $priority = JudgeTas return; } - $this->actuallyCreateJudgetasks($priority, $judging); + $this->actuallyCreateJudgetasks($priority, $judging, $overshoot); $team = $submission->getTeam(); $result = $this->em->createQueryBuilder() @@ -1423,7 +1423,7 @@ public function parseMetadata(string $raw_metadata): array return $res; } - public function getRunConfig(ContestProblem $problem, Submission $submission): string + public function getRunConfig(ContestProblem $problem, Submission $submission, int $overshoot = 0): string { $memoryLimit = $problem->getProblem()->getMemlimit(); $outputLimit = $problem->getProblem()->getOutputlimit(); @@ -1444,6 +1444,7 @@ public function getRunConfig(ContestProblem $problem, Submission $submission): s 'entry_point' => $submission->getEntryPoint(), 'pass_limit' => $problem->getProblem()->getMultipassLimit(), 'hash' => $runExecutable->getHash(), + 'overshoot' => $overshoot, ] ); } @@ -1587,7 +1588,7 @@ private function allowJudge(ContestProblem $problem, Submission $submission, Lan return !$evalOnDemand; } - private function actuallyCreateJudgetasks(int $priority, Judging $judging): void + private function actuallyCreateJudgetasks(int $priority, Judging $judging, int $overshoot = 0): void { $submission = $judging->getSubmission(); $problem = $submission->getContestProblem(); @@ -1606,7 +1607,7 @@ private function actuallyCreateJudgetasks(int $priority, Judging $judging): void ':compare_script_id' => $this->getImmutableCompareExecutable($problem)->getImmutableExecId(), ':run_script_id' => $this->getImmutableRunExecutable($problem)->getImmutableExecId(), ':compile_config' => $this->getCompileConfig($submission), - ':run_config' => $this->getRunConfig($problem, $submission), + ':run_config' => $this->getRunConfig($problem, $submission, $overshoot), ':compare_config' => $this->getCompareConfig($problem), ]; diff --git a/webapp/src/Service/RejudgingService.php b/webapp/src/Service/RejudgingService.php index 280c3b7a21..630fe65122 100644 --- a/webapp/src/Service/RejudgingService.php +++ b/webapp/src/Service/RejudgingService.php @@ -53,6 +53,7 @@ public function createRejudging( array $judgings, bool $autoApply, ?int $repeat, + ?int $overshoot, ?Rejudging $repeatedRejudging, array &$skipped, ?callable $progressReporter = null @@ -153,7 +154,7 @@ public function createRejudging( ->getQuery() ->getSingleResult(); - $this->dj->maybeCreateJudgeTasks($newJudging, $priority); + $this->dj->maybeCreateJudgeTasks($newJudging, $priority, false, $overshoot); $this->em->getConnection()->commit(); diff --git a/webapp/templates/jury/partials/rejudge_form.html.twig b/webapp/templates/jury/partials/rejudge_form.html.twig index 6fe8080c85..1bf2bdb4ed 100644 --- a/webapp/templates/jury/partials/rejudge_form.html.twig +++ b/webapp/templates/jury/partials/rejudge_form.html.twig @@ -92,6 +92,10 @@ +