Skip to content

Add advanced rejudge scheduling#754

Open
Jankwi wants to merge 12 commits into
sio2project:masterfrom
Jankwi:multi-problem-queue
Open

Add advanced rejudge scheduling#754
Jankwi wants to merge 12 commits into
sio2project:masterfrom
Jankwi:multi-problem-queue

Conversation

@Jankwi

@Jankwi Jankwi commented May 27, 2026

Copy link
Copy Markdown
Contributor

This commit adds a scheduling option, which allows the user to specify how submission jobs will be evaluated in the rejudge queue, with the following options:

  1. Instant - submissions are evaluated ASAP.
  2. Delayed - submissions jobs are switched from queued to waiting, evenly over 10 minutes.
  3. Slow - same as above, but over 1 hour.
  4. Custom - The user can specify that X new submissions will be switched from queued to waiting every Y seconds.
image

With the info button pressed, the screen looks like this:
image

Note: This is a clean version of this old draft PR: #724

Closes: #672

Copilot AI review requested due to automatic review settings May 27, 2026 14:34
@Jankwi Jankwi requested a review from MasloMaslane as a code owner May 27, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “evaluation scheduling” option to the rejudge flow so admins can spread rejudge jobs over time (instant / delayed / slow / custom cadence), leveraging Celery countdown scheduling.

Changes:

  • Extend judge() plumbing (contest + problem controllers) to accept an optional delay and pass it to the eval manager as countdown.
  • Add scheduling parameter parsing and apply per-submission delays when enqueueing rejudge jobs.
  • Add UI controls and tests for the new scheduling options.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
oioioi/problems/controllers.py Adds delay parameter and forwards it as Celery countdown when scheduling evaluation.
oioioi/contests/controllers.py Extends contest-controller judge() to forward delay to the problem controller.
oioioi/contests/views.py Implements scheduling option parsing and applies computed delays during rejudge enqueueing.
oioioi/contests/templates/contests/confirm_rejudge.html Adds scheduling selector UI (instant/delayed/slow/custom) and custom-parameter inputs.
oioioi/contests/tests/tests.py Adds tests validating that delays are passed to judge() according to selected scheduling.
oioioi/default_settings.py Introduces default settings for delayed/slow durations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread oioioi/contests/views.py Outdated
Comment thread oioioi/contests/views.py
Comment thread oioioi/contests/views.py
Comment thread oioioi/contests/templates/contests/confirm_rejudge.html Outdated
Comment thread oioioi/contests/templates/contests/confirm_rejudge.html Outdated
Comment thread oioioi/contests/templates/contests/confirm_rejudge.html
Comment thread oioioi/contests/tests/tests.py
Comment thread oioioi/contests/tests/tests.py
@sylwia-sapkowska sylwia-sapkowska self-requested a review May 27, 2026 16:37
Jankwi and others added 4 commits May 27, 2026 21:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Previously, if 0 submission were selected with a custom rejudge ootion, the program tried to divide the time by 0, to spread them out evenly. This commit adds necessary guards, so that for 0 selected submissions these calculations are not completed. Selecting 0 submissions is not an error, but it doesn't result in anything besides a message.

@sylwia-sapkowska sylwia-sapkowska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me.

@sonarqubecloud

Copy link
Copy Markdown

@Jankwi

Jankwi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@twalen I have moved CSS from the html file, to a separate static file as requested. This PR should be ready for merge now.

@malevitzch malevitzch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few problems with the style, otherwise it looks solid

});
}

// Initialize on page load

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this comment

border-bottom-right-radius: 0.375rem;
}

/* Active State Style */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is obsolete and the code already passes that infromation in the css class name "btn-check:chceked"

FORUM_POST_MAX_LENGTH = 20000
FORUM_REACTIONS_TO_DISPLAY = 10

# REJUDGE EVALUATION SCHEDULING VARIABLES

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment should be in all caps, other comments in the same file use regular case

Image Image

pass

def judge(self, submission, extra_args=None, is_rejudge=False):
def judge(self, submission, extra_args=None, is_rejudge=False, delay: int | float = 0):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The single type annotation stands out here, I understand that submission can't be typed right now, but extra_args could be "dict[str, Any] | None" and is_rejudge could just be "bool" if you wish to use type annotations


def judge(self, submission, extra_args=None, is_rejudge=False):
submission.problem_instance.problem.controller.judge(submission, extra_args, is_rejudge)
def judge(self, submission, extra_args=None, is_rejudge=False, delay: int | float = 0):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the typing here, same as in oioioi/problems/controllers.py

const delayStepInput = document.getElementById('custom_delay_step');

if (batchSizeInput && delayStepInput) {
// Check if custom is already selected on page load

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one, those comments are made obsolete by reading the code even without deeper javascript knowledge

const batchSizeInput = document.getElementById('custom_batch_size');
const delayStepInput = document.getElementById('custom_delay_step');

if (this.value === 'custom') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like you are doing CSS's job with javascript here, but I might be wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced rejudge queue

4 participants