Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for ondemand mode to do a full judging in 1 buttonpress #2380

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
11 changes: 11 additions & 0 deletions webapp/src/Controller/Jury/SubmissionController.php
vmcj marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@
->getSingleScalarResult();
}

$evalOnDemand = $submission->getContestProblem()->determineOnDemand($this->config->get('lazy_eval_results'));

Check failure on line 497 in webapp/src/Controller/Jury/SubmissionController.php

View workflow job for this annotation

GitHub Actions / phpcs

Spaces must be used to indent lines; tabs are not allowed

Check failure on line 497 in webapp/src/Controller/Jury/SubmissionController.php

View workflow job for this annotation

GitHub Actions / phpcs

Line indented incorrectly; expected at least 8 spaces, found 4

$twigData = [
'submission' => $submission,
'lastSubmission' => $lastSubmission,
Expand All @@ -515,6 +517,7 @@
'combinedRunCompare' => $submission->getProblem()->getCombinedRunCompare(),
'requestedOutputCount' => $requestedOutputCount,
'version_warnings' => [],
'evalOnDemand' => $evalOnDemand,
];

if ($selectedJudging === null) {
Expand Down Expand Up @@ -1203,6 +1206,14 @@
return $this->redirectToRoute('jury_submission', ['submitId' => $submitId]);
}

#[Route(path: '/{submitId<\d+>}/create-tasks-full', name: 'jury_submission_create_tasks_full')]
public function createJudgeTasksFull(string $submitId): RedirectResponse
{
$this->dj->unblockJudgeTasksForSubmission($submitId, true);
$this->addFlash('info', "Started judging all testcases for submission: $submitId");
return $this->redirectToRoute('jury_submission', ['submitId' => $submitId]);
}

/**
* @param string[] $allErrors
*/
Expand Down
10 changes: 7 additions & 3 deletions webapp/src/Service/DOMJudgeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ public function unblockJudgeTasksForProblem(int $probId): void
}
}

public function unblockJudgeTasksForSubmission(string $submissionId): void
public function unblockJudgeTasksForSubmission(string $submissionId, bool $judgeCompletely = false): void
{
// These are all the judgings that don't have associated judgetasks yet. Check whether we unblocked them.
$judgings = $this->helperUnblockJudgeTasks()
Expand All @@ -1136,7 +1136,7 @@ public function unblockJudgeTasksForSubmission(string $submissionId): void
->getQuery()
->getResult();
foreach ($judgings as $judging) {
$this->maybeCreateJudgeTasks($judging, JudgeTask::PRIORITY_DEFAULT, true);
$this->maybeCreateJudgeTasks($judging, JudgeTask::PRIORITY_DEFAULT, true, judgeCompletely: $judgeCompletely);
}
}

Expand All @@ -1151,7 +1151,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, bool $judgeCompletely = false): void
{
$submission = $judging->getSubmission();
$problem = $submission->getContestProblem();
Expand Down Expand Up @@ -1181,6 +1181,10 @@ public function maybeCreateJudgeTasks(Judging $judging, int $priority = JudgeTas
return;
}

if ($judgeCompletely) {
$judging->setJudgeCompletely(true);
}

// We use a mass insert query, since that is way faster than doing a separate insert for each testcase.
// We first insert judgetasks, then select their ID's and finally insert the judging runs.

Expand Down
11 changes: 10 additions & 1 deletion webapp/templates/jury/submission.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,19 @@
&nbsp;
{% if selectedJudging is null or selectedJudging.result is empty %}
{%- if not selectedJudging or not selectedJudging.started %}
{% if evalOnDemand %}
<a href="{{ path('jury_submission_create_tasks_full', {'submitId': submission.submitid}) }}">
<button class="btn btn-sm btn-outline-secondary" >
<i class="fas fa-gavel"></i>
Judge submission (all testcases)
</button>
</a>
&nbsp;
{% endif %}
<a href="{{ path('jury_submission_create_tasks', {'submitId': submission.submitid}) }}">
<button class="btn btn-sm btn-outline-secondary" >
<i class="fas fa-gavel"></i>
Judge submission
Judge submission {% if evalOnDemand %}(lazy){% endif %}
</button>
</a>
{%- endif %}
Expand Down
Loading