From 2530b9898f4109dff5fbf626f1eac36eefc647cf Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Mon, 1 Feb 2021 18:14:34 -0800 Subject: [PATCH 1/5] 245 and 241 intermittent-task --- src/scriptworker/constants.py | 2 +- tests/test_task.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scriptworker/constants.py b/src/scriptworker/constants.py index f49e3192f..8d938c5dd 100644 --- a/src/scriptworker/constants.py +++ b/src/scriptworker/constants.py @@ -49,7 +49,7 @@ "reclaim_interval": 300, "poll_interval": 10, "sign_key_timeout": 60 * 2, - "reversed_statuses": immutabledict({-11: STATUSES["intermittent-task"], -15: STATUSES["intermittent-task"]}), + "reversed_statuses": immutabledict({-11: "intermittent-task", -15: "intermittent-task", 245: "intermittent-task", 241: "intermittent-task"}), # Report this status on max_timeout. `intermittent-task` will rerun the # task automatically. `internal-error` or other will require manual # intervention. diff --git a/tests/test_task.py b/tests/test_task.py index e5bd61231..ba1eda860 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -520,6 +520,14 @@ async def test_reportException(context, successful_queue): assert successful_queue.info == ["reportException", ("taskId", "runId", {"reason": "worker-shutdown"}), {}] +@pytest.mark.parametrize("exit_code", (-11, -15, 245, 241)) +@pytest.mark.asyncio +async def test_reversed_statuses(context, successful_queue, exit_code): + context.temp_queue = successful_queue + await swtask.complete_task(context, exit_code) + assert successful_queue.info == ["reportException", ("taskId", "runId", {"reason": context.config["reversed_statuses"][exit_code]}), {}] + + # complete_task {{{1 @pytest.mark.asyncio async def test_complete_task_409(context, unsuccessful_queue): From 4d165148bf89b53d8a1328e14fdd31ace2fa910f Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Tue, 16 Feb 2021 14:59:16 -0800 Subject: [PATCH 2/5] actually use the exit code from the task --- src/scriptworker/constants.py | 2 +- src/scriptworker/task.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scriptworker/constants.py b/src/scriptworker/constants.py index 8d938c5dd..109913379 100644 --- a/src/scriptworker/constants.py +++ b/src/scriptworker/constants.py @@ -49,7 +49,7 @@ "reclaim_interval": 300, "poll_interval": 10, "sign_key_timeout": 60 * 2, - "reversed_statuses": immutabledict({-11: "intermittent-task", -15: "intermittent-task", 245: "intermittent-task", 241: "intermittent-task"}), + "reversed_statuses": immutabledict({245: "intermittent-task", 241: "intermittent-task"}), # Report this status on max_timeout. `intermittent-task` will rerun the # task automatically. `internal-error` or other will require manual # intervention. diff --git a/src/scriptworker/task.py b/src/scriptworker/task.py index 297e16609..1ce9d8c37 100644 --- a/src/scriptworker/task.py +++ b/src/scriptworker/task.py @@ -644,7 +644,7 @@ async def run_task(context, to_cancellable_process): if stopped_due_to_worker_shutdown: raise WorkerShutdownDuringTask - return 1 if exitcode != 0 else 0 + return exitcode # reclaim_task {{{1 From 1bc324c56bf14acc02dc685adaff0c29ff0b922e Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Tue, 16 Feb 2021 15:08:42 -0800 Subject: [PATCH 3/5] no longer -11 and -15 --- tests/test_task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_task.py b/tests/test_task.py index ba1eda860..08922b751 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -520,7 +520,7 @@ async def test_reportException(context, successful_queue): assert successful_queue.info == ["reportException", ("taskId", "runId", {"reason": "worker-shutdown"}), {}] -@pytest.mark.parametrize("exit_code", (-11, -15, 245, 241)) +@pytest.mark.parametrize("exit_code", (245, 241)) @pytest.mark.asyncio async def test_reversed_statuses(context, successful_queue, exit_code): context.temp_queue = successful_queue From 7f06d6ddd2b8836a025e97305250f22995b94fdd Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Tue, 16 Feb 2021 15:15:49 -0800 Subject: [PATCH 4/5] 37.0.0 --- HISTORY.rst | 7 +++++++ src/scriptworker/version.py | 2 +- version.json | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 841221074..11f948715 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,13 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to `Semantic Versioning `__. +[37.0.0] - 2021-02-17 +--------------------- +Changed +~~~~~~~ +- ``run_task`` now exits with the exit code from the task. +- ``reversed_statuses`` works now, with statuses of 245 and 241. + [36.0.5] - 2021-02-11 --------------------- Changed diff --git a/src/scriptworker/version.py b/src/scriptworker/version.py index 7df082cda..54ebeff1a 100755 --- a/src/scriptworker/version.py +++ b/src/scriptworker/version.py @@ -54,7 +54,7 @@ def get_version_string(version: Union[ShortVerType, LongVerType]) -> str: # 1}}} # Semantic versioning 2.0.0 http://semver.org/ -__version__ = (36, 0, 5) +__version__ = (37, 0, 0) __version_string__ = get_version_string(__version__) diff --git a/version.json b/version.json index ce342fc02..a88ae46d8 100644 --- a/version.json +++ b/version.json @@ -1,8 +1,8 @@ { "version":[ - 36, + 37, 0, - 5 + 0 ], - "version_string":"36.0.5" + "version_string":"37.0.0" } From 024e882cd7e933e027783704c60771c54ef0f18f Mon Sep 17 00:00:00 2001 From: Aki Sasaki Date: Fri, 19 Feb 2021 10:32:05 -0800 Subject: [PATCH 5/5] fix 37.0.0 release date --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 11f948715..c63f48cf8 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to `Semantic Versioning `__. -[37.0.0] - 2021-02-17 +[37.0.0] - 2021-02-19 --------------------- Changed ~~~~~~~