From 356b146f37768fc05b1711f523adcd091c781b49 Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Mon, 25 Dec 2023 16:46:59 -0500 Subject: [PATCH] events: properly publish abort events I think this should avoid cases of the "Abort" button sticking around. --- judge/bridge/judge_handler.py | 4 ++-- judge/judgeapi.py | 2 +- templates/submission/status.html | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/judge/bridge/judge_handler.py b/judge/bridge/judge_handler.py index 6eb49dc7f2..073de27262 100644 --- a/judge/bridge/judge_handler.py +++ b/judge/bridge/judge_handler.py @@ -476,8 +476,8 @@ def on_submission_terminated(self, packet): self._free_self(packet) if Submission.objects.filter(id=packet['submission-id']).update(status='AB', result='AB', points=0): - event.post('sub_%s' % Submission.get_id_secret(packet['submission-id']), {'type': 'aborted-submission'}) - self._post_update_submission(packet['submission-id'], 'terminated', done=True) + event.post('sub_%s' % Submission.get_id_secret(packet['submission-id']), {'type': 'aborted'}) + self._post_update_submission(packet['submission-id'], 'aborted', done=True) json_log.info(self._make_json_log(packet, action='aborted', finish=True, result='AB')) else: logger.warning('Unknown submission: %s', packet['submission-id']) diff --git a/judge/judgeapi.py b/judge/judgeapi.py index c502158767..25a34db3af 100644 --- a/judge/judgeapi.py +++ b/judge/judgeapi.py @@ -119,5 +119,5 @@ def abort_submission(submission): # and returns a bad-request, the submission is not falsely shown as "Aborted" when it will still be judged. if not response.get('judge-aborted', True): Submission.objects.filter(id=submission.id).update(status='AB', result='AB', points=0) - event.post('sub_%s' % Submission.get_id_secret(submission.id), {'type': 'aborted-submission'}) + event.post('sub_%s' % Submission.get_id_secret(submission.id), {'type': 'aborted'}) _post_update_submission(submission, done=True) diff --git a/templates/submission/status.html b/templates/submission/status.html index 9a75f69b7c..5e3f3def3e 100644 --- a/templates/submission/status.html +++ b/templates/submission/status.html @@ -38,6 +38,7 @@ "{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}", ['sub_{{ submission.id_secret }}'], {{ last_msg }}, function (message) { switch (message.type) { + case 'aborted': case 'internal-error': case 'grading-end': case 'compile-error':