From 2d1fa49b2a9104a7d196fb3543fd521ae53b2a5c Mon Sep 17 00:00:00 2001 From: Mehran Kholdi Date: Sat, 22 Jan 2022 00:19:00 +0330 Subject: [PATCH] Delete task pods even upon failure To prevent cluttering the namespace with lots of failing task pods. --- orchestrator/k8s.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchestrator/k8s.py b/orchestrator/k8s.py index f45057e..625b48b 100644 --- a/orchestrator/k8s.py +++ b/orchestrator/k8s.py @@ -66,9 +66,9 @@ def run_on_node(fn, node): return False wait_for(is_finished, "task to finish") + task_pod.delete() if task_pod.obj["status"]["phase"] != "Succeeded": exit_code = task_pod.obj["status"]["containerStatuses"][0]["state"][ "terminated" ]["exitCode"] raise CalledProcessError(returncode=exit_code, cmd=f"Task: {name}") - task_pod.delete()