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

Change state to in progress when send to worker

parent 6cd0a235
......@@ -47,7 +47,7 @@ class SubmissionProcessor:
self.submission.state = state
self.submission.async_task_id = None
self._rest.submissions.write_entity(self.submission)
self._save_submission()
def submission_enqueue_ended(self):
log.info(f"[ASYNC] Submission enqueue ended {self.submission.log_name}: {self.submission}")
......@@ -63,7 +63,7 @@ class SubmissionProcessor:
args = (self.submission.id, self.params)
from .tasks import start_processing_submission
self.submission.scheduled_for = delay
self._rest.general.write_entity(self.submission)
self._save_submission()
start_processing_submission.apply_async(args=args, countdown=delay)
def submission_store_ended(self, version: str):
......@@ -140,6 +140,8 @@ class SubmissionProcessor:
def execute_submission(self, worker: Worker):
worker_client = self._rest.workers(worker).worker_client
self.submission.change_state(SubmissionState.IN_PROGRESS)
self._save_submission()
worker_client.execute_submission(self.submission)
def _worker_not_available(self):
......@@ -170,3 +172,6 @@ class SubmissionProcessor:
def abort_submission(self, message: str = 'Unknown error!'):
self.submission.note['error'] = message
self.reset_task_id(SubmissionState.ABORTED)
def _save_submission(self):
self._rest.submissions.write_entity(self.submission)
......@@ -3,6 +3,7 @@ from storage import UploadedEntity
from portal import storage
from portal.async_celery import celery_app, submission_processor
from portal.database import SubmissionState
log = get_task_logger(__name__)
......
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