Verified Commit bb7a8b4f authored by Peter Stanko's avatar Peter Stanko
Browse files

Submission aborted when download

parent 2630998e
......@@ -5,8 +5,7 @@ from typing import Optional
from storage import UploadedEntity, entities
import portal.tools.worker_client
from portal import logger, tools
from portal import logger
from portal.database import Project, Submission, SubmissionState, Worker
from portal.database.models import WorkerState
from portal.service import errors
......@@ -74,6 +73,7 @@ class SubmissionProcessor:
def download_submission(self):
file_params = self.params['file_params']
log.info(f"[ASYNC] Uploading submission: {self.submission.log_name} with {file_params}")
updated_entity: UploadedEntity = self.storage. \
submissions.create(entity_id=self.submission.id, **file_params)
self.submission_store_ended(version=updated_entity.version)
......@@ -99,7 +99,11 @@ class SubmissionProcessor:
def process_submission(self):
log.info(f"[ASYNC] Processing submission {self.submission.log_name}")
self.download_submission()
try:
self.download_submission()
except Exception as ex:
log.error(f"[PROC] Storage submission download aborted due error: {ex}")
self.abort_submission('Unable to download a submission')
self.dispatch_submission_processing()
def revoke_task(self):
......@@ -160,3 +164,7 @@ class SubmissionProcessor:
self.submission.result = result
self.submission.points = points
return self.submission
def abort_submission(self, message: str = 'Unknown error!'):
self.submission.note['error'] = message
self.reset_task_id(SubmissionState.ABORTED)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment