From b44efb359361cf60f294455f1d96567fedc9462b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20Jer=C5=A1e?= Date: Mon, 2 Dec 2024 13:50:58 +0100 Subject: [PATCH] Fix null executor --- docs/CHANGELOG.rst | 1 + resolwe/flow/executors/null/prepare.py | 8 +++++--- resolwe/flow/tests/test_executors.py | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 0b683cb37..d4873fa35 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -18,6 +18,7 @@ Added Changed ------- - Make processing container startup script ``Python`` 3.12 compatible +- Fix stop null executor processing in the preparation phase Fixed ----- diff --git a/resolwe/flow/executors/null/prepare.py b/resolwe/flow/executors/null/prepare.py index 95035530c..f5f65e4eb 100644 --- a/resolwe/flow/executors/null/prepare.py +++ b/resolwe/flow/executors/null/prepare.py @@ -8,7 +8,7 @@ method. """ -from resolwe.flow.models import Worker +from resolwe.flow.models import Data, Worker from ..prepare import BaseFlowExecutorPreparer # noqa: F401 @@ -19,7 +19,9 @@ class FlowExecutorPreparer(BaseFlowExecutorPreparer): def prepare_for_execution(self, data): """Prepare the data object for the execution. - Mark worker object as done. + Mark data and its worker object as completed. """ + data.status = Data.STATUS_DONE data.worker.status = Worker.STATUS_COMPLETED - data.worker.save() + data.worker.save(update_fields=["status"]) + data.save(update_fields=["status"]) diff --git a/resolwe/flow/tests/test_executors.py b/resolwe/flow/tests/test_executors.py index 0ff49faf3..a789f5b6d 100644 --- a/resolwe/flow/tests/test_executors.py +++ b/resolwe/flow/tests/test_executors.py @@ -791,12 +791,11 @@ def test_docker_uid_gid(self): data = self.run_process("test-docker-uid-gid") self.assertEqual(data.output["result"], "OK") - @unittest.skip("Null executor test currently not working.") @with_null_executor @tag_process("test-save-number") def test_null_executor(self): data = self.run_process( - "test-save-number", {"number": 19}, assert_status=Data.STATUS_WAITING + "test-save-number", {"number": 19}, assert_status=Data.STATUS_DONE ) self.assertEqual(data.input["number"], 19) self.assertEqual(data.output, {})