diff --git a/cms/service/ProxyService.py b/cms/service/ProxyService.py index 3feed45a43..ab37a1e060 100644 --- a/cms/service/ProxyService.py +++ b/cms/service/ProxyService.py @@ -477,6 +477,14 @@ def submission_scored(self, submission_id): "unexistent submission id %s.", submission_id) raise KeyError("Submission not found.") + # ScoringService sent us a submission of another contest, they + # do not know about our contest_id in multicontest setup. + if submission.task.contest_id != self.contest_id: + logger.debug("Ignoring submission %s of contest %d " + "(this ProxyService considers contest %d only)", + submission.id, submission.task.contest_id, self.contest_id) + return + if submission.participation.hidden: logger.info("[submission_scored] Score for submission %d " "not sent because the participation is hidden.", @@ -489,11 +497,6 @@ def submission_scored(self, submission_id): submission_id) return - # ScoringService sent us a submission of another contest, they - # do not know about our contest_id in multicontest setup. - if submission.task.contest_id != self.contest_id: - return - # Update RWS. for operation in self.operations_for_score(submission): self.enqueue(operation) @@ -517,6 +520,14 @@ def submission_tokened(self, submission_id): "unexistent submission id %s.", submission_id) raise KeyError("Submission not found.") + # ScoringService sent us a submission of another contest, they + # do not know about our contest_id in multicontest setup. + if submission.task.contest_id != self.contest_id: + logger.debug("Ignoring submission %s of contest %d " + "(this ProxyService considers contest %d only)", + submission.id, submission.task.contest_id, self.contest_id) + return + if submission.participation.hidden: logger.info("[submission_tokened] Token for submission %d " "not sent because participation is hidden.", @@ -529,11 +540,6 @@ def submission_tokened(self, submission_id): submission_id) return - # ScoringService sent us a submission of another contest, they - # do not know about our contest_id in multicontest setup. - if submission.task.contest_id != self.contest_id: - return - # Update RWS. for operation in self.operations_for_token(submission): self.enqueue(operation) @@ -556,6 +562,14 @@ def dataset_updated(self, task_id): task = Task.get_from_id(task_id, session) dataset = task.active_dataset + # This ProxyService may focus on a different contest, and it should + # ignore this update. + if task.contest_id != self.contest_id: + logger.debug("Ignoring dataset change for task %d of contest %d " + "(this ProxyService considers contest %d only)", + task_id, task.contest.id, self.contest_id) + return + logger.info("Dataset update for task %d (dataset now is %d).", task.id, dataset.id)