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

Make manage submissions rejudging idempotent; fixes #1009 #1127

Merged
merged 3 commits into from
Oct 21, 2019
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
4 changes: 3 additions & 1 deletion judge/bridge/judgelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ def check_priority(self, priority):
def judge(self, id, problem, language, source, priority):
with self.lock:
if id in self.submission_map or id in self.node_map:
logger.warning('Already judging? %d', id)
# Already judging, don't queue again. This can happen during batch rejudges, rejudges should be
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed this warning because despite filtering earlier (which is useful for showing users accurate submission counts), we can still race to this point.

# idempotent.
return

candidates = [judge for judge in self.judges if not judge.working and judge.can_judge(problem, language)]
logger.info('Free judges: %d', len(candidates))
if candidates:
# Schedule the submission on the judge reporting least load.
judge = min(candidates, key=attrgetter('load'))
logger.info('Dispatched submission %d to: %s', id, judge.name)
self.submission_map[id] = judge
Expand Down
1 change: 1 addition & 0 deletions judge/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Submission(models.Model):
('CE', _('Compile Error')),
('AB', _('Aborted')),
)
IN_PROGRESS_GRADING_STATUS = ('QU', 'P', 'G')
RESULT = SUBMISSION_RESULT
USER_DISPLAY_CODES = {
'AC': _('Accepted'),
Expand Down
1 change: 1 addition & 0 deletions judge/tasks/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def apply_submission_filter(queryset, id_range, languages, results):
queryset = queryset.filter(language_id__in=languages)
if results:
queryset = queryset.filter(result__in=results)
queryset = queryset.exclude(status__in=Submission.IN_PROGRESS_GRADING_STATUS)
return queryset


Expand Down