Skip to content

Commit

Permalink
Merge pull request #941 from UCL-INGI/fix_697
Browse files Browse the repository at this point in the history
[frontend/submission_manager] catch DocumentTooLarge exception
  • Loading branch information
Drumor committed Apr 26, 2023
2 parents 789df86 + 09629d1 commit f348216
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions inginious/frontend/submission_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,26 @@ def _job_done_callback(self, submissionid, task, result, grade, problems, tests,
}

# Save submission to database
submission = self._database.submissions.find_one_and_update(
{"_id": submission["_id"]},
{"$set": data, "$unset": unset_obj},
return_document=ReturnDocument.AFTER
)
try:
submission = self._database.submissions.find_one_and_update(
{"_id": submission["_id"]},
{"$set": data, "$unset": unset_obj},
return_document=ReturnDocument.AFTER
)

self._plugin_manager.call_hook("submission_done", submission=submission, archive=archive, newsub=newsub)
for username in submission["username"]:
self._user_manager.update_user_stats(username, task, submission, result[0], grade, state, newsub, task_dispenser)

# Check for size as it also takes the MongoDB command into consideration
except pymongo.errors.DocumentTooLarge:
data = {"status": "error", "text": _("Maximum submission size exceeded. Check feedback, stdout, stderr and state."), "grade": 0.0}
submission = self._database.submissions.find_one_and_update(
{"_id": submission["_id"]},
{"$set": data, "$unset": unset_obj},
return_document=ReturnDocument.AFTER
)

for username in submission["username"]:
self._user_manager.update_user_stats(username, task, submission, result[0], grade, state, newsub, task_dispenser)
self._plugin_manager.call_hook("submission_done", submission=submission, archive=archive, newsub=newsub)

if "outcome_service_url" in submission and "outcome_result_id" in submission and "outcome_consumer_key" in submission:
for username in submission["username"]:
Expand Down

0 comments on commit f348216

Please sign in to comment.