Revert "Try optimizing batch rejudge"

This reverts commit fbd1d865fa.
This commit is contained in:
cuom1999 2023-05-27 09:00:42 +07:00
parent fbd1d865fa
commit 2291d6bbb8
2 changed files with 5 additions and 12 deletions

View file

@ -56,7 +56,7 @@ def judge_request(packet, reply=True):
return result
def judge_submission(submission, rejudge=False, batch_rejudge=False, judge_id=None, delete_testcases=True):
def judge_submission(submission, rejudge=False, batch_rejudge=False, judge_id=None):
from .models import ContestSubmission, Submission, SubmissionTestCase
CONTEST_SUBMISSION_PRIORITY = 0
@ -101,8 +101,7 @@ def judge_submission(submission, rejudge=False, batch_rejudge=False, judge_id=No
):
return False
if delete_testcases:
SubmissionTestCase.objects.filter(submission_id=submission.id).delete()
SubmissionTestCase.objects.filter(submission_id=submission.id).delete()
try:
response = judge_request(

View file

@ -2,7 +2,7 @@ from celery import shared_task
from django.core.cache import cache
from django.utils.translation import gettext as _
from judge.models import Problem, Profile, Submission, SubmissionTestCase
from judge.models import Problem, Profile, Submission
from judge.utils.celery import Progress
__all__ = ("apply_submission_filter", "rejudge_problem_filter", "rescore_problem")
@ -30,15 +30,9 @@ def rejudge_problem_filter(
queryset = apply_submission_filter(queryset, id_range, languages, results, contest)
rejudged = 0
with Progress(self, queryset.count() * 2) as p:
for submission in queryset:
SubmissionTestCase.objects.filter(submission_id=submission.id).delete()
rejudged += 1
if rejudged % 10 == 0:
p.done = rejudged
with Progress(self, queryset.count()) as p:
for submission in queryset.iterator():
submission.judge(rejudge=True, batch_rejudge=True, delete_testcases=False)
submission.judge(rejudge=True, batch_rejudge=True)
rejudged += 1
if rejudged % 10 == 0:
p.done = rejudged