Delete task pods even upon failure

To prevent cluttering the namespace with lots of failing task pods.
This commit is contained in:
Mehran Kholdi 2022-01-22 00:19:00 +03:30 committed by Lauri Võsandi
parent 6ab8470221
commit 14fb741bdc

View File

@ -66,9 +66,9 @@ def run_on_node(fn, node):
return False return False
wait_for(is_finished, "task to finish") wait_for(is_finished, "task to finish")
task_pod.delete()
if task_pod.obj["status"]["phase"] != "Succeeded": if task_pod.obj["status"]["phase"] != "Succeeded":
exit_code = task_pod.obj["status"]["containerStatuses"][0]["state"][ exit_code = task_pod.obj["status"]["containerStatuses"][0]["state"][
"terminated" "terminated"
]["exitCode"] ]["exitCode"]
raise CalledProcessError(returncode=exit_code, cmd=f"Task: {name}") raise CalledProcessError(returncode=exit_code, cmd=f"Task: {name}")
task_pod.delete()