diff --git a/backend/src/predicTCR_server/app.py b/backend/src/predicTCR_server/app.py index b7d079d..8a79e4b 100644 --- a/backend/src/predicTCR_server/app.py +++ b/backend/src/predicTCR_server/app.py @@ -285,6 +285,7 @@ def admin_resubmit_sample(sample_id: int): sample.trusted_user_result_file_path().unlink(missing_ok=True) sample.admin_result_file_path().unlink(missing_ok=True) sample.has_results_zip = False + sample.error_message = "" sample.status = Status.QUEUED db.session.commit() return jsonify(message="Sample added to the queue") diff --git a/backend/src/predicTCR_server/model.py b/backend/src/predicTCR_server/model.py index 046a298..0b9bc4c 100644 --- a/backend/src/predicTCR_server/model.py +++ b/backend/src/predicTCR_server/model.py @@ -85,6 +85,7 @@ class Sample(db.Model): timestamp_job_end: Mapped[int] = mapped_column(Integer, nullable=False) status: Mapped[Status] = mapped_column(Enum(Status), nullable=False) has_results_zip: Mapped[bool] = mapped_column(Boolean, nullable=False) + error_message: Mapped[str] = mapped_column(String, nullable=False) def base_path(self) -> pathlib.Path: data_path = flask.current_app.config["PREDICTCR_DATA_PATH"] @@ -216,9 +217,11 @@ def process_result( job.timestamp_end = timestamp_now() if success: job.status = Status.COMPLETED + sample.error_message = "" else: job.status = Status.FAILED job.error_message = error_message + sample.error_message = error_message db.session.commit() if sample.has_results_zip: logger.warning(f" --> Sample {sample_id} already has results") @@ -503,6 +506,7 @@ def add_new_sample( timestamp_job_end=0, status=Status.QUEUED, has_results_zip=False, + error_message="", ) db.session.add(new_sample) db.session.commit() diff --git a/backend/tests/helpers/flask_test_utils.py b/backend/tests/helpers/flask_test_utils.py index 3a2da58..0518f93 100644 --- a/backend/tests/helpers/flask_test_utils.py +++ b/backend/tests/helpers/flask_test_utils.py @@ -58,6 +58,7 @@ def add_test_samples(app, data_path: pathlib.Path): timestamp_job_end=0, status=status, has_results_zip=False, + error_message="", ) db.session.add(new_sample) db.session.commit() diff --git a/frontend/src/components/SamplesTable.vue b/frontend/src/components/SamplesTable.vue index a438e59..e4cea3c 100644 --- a/frontend/src/components/SamplesTable.vue +++ b/frontend/src/components/SamplesTable.vue @@ -105,6 +105,7 @@ function download_samples_as_csv() { Runtime Inputs Results + Error message Actions @@ -155,6 +156,7 @@ function download_samples_as_csv() { + {{ sample.error_message }}