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
5 changes: 3 additions & 2 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -1372,8 +1372,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
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Controller/Jury/InternalErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public function handleAction(Request $request, ?Profiler $profiler, int $errorId
$affectedJudgings->getValues(),
false,
0,
0,
null,
$skipped,
$progressReporter);
Expand Down
8 changes: 5 additions & 3 deletions webapp/src/Controller/Jury/RejudgingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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());
Expand Down
6 changes: 6 additions & 0 deletions webapp/src/Form/Type/RejudgingType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 6 additions & 5 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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()
Expand Down Expand Up @@ -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();
Expand All @@ -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,
]
);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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),
];

Expand Down
3 changes: 2 additions & 1 deletion webapp/src/Service/RejudgingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function createRejudging(
array $judgings,
bool $autoApply,
?int $repeat,
?int $overshoot,
?Rejudging $repeatedRejudging,
array &$skipped,
?callable $progressReporter = null
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 4 additions & 0 deletions webapp/templates/jury/partials/rejudge_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
<option value="high">high</option>
</select>
</div>
<div id="rejudge-overshoot" class="mb-3">
<label for="overshoot">Additional grace time (in s)</label>
<input type="number" class="form-control" name="overshoot" id="overshoot" value="0" min="0" max="999" step="1">
</div>
{% endif %}
</div>
<div class="modal-footer">
Expand Down
Loading