EamonKeane commented on a change in pull request #4160: [AIRFLOW-3311] Allow
pod operator to keep failed pods
URL: https://github.com/apache/incubator-airflow/pull/4160#discussion_r238708915
##########
File path: tests/contrib/minikube/test_kubernetes_pod_operator.py
##########
@@ -111,6 +111,21 @@ def test_delete_operator_pod():
)
k.execute(None)
+ def test_keep_failed_pod(self):
+ k = KubernetesPodOperator(
+ namespace='default',
+ image="ubuntu:16.04",
+ cmds=["bash", "-cx"],
+ arguments=["exit 1"],
+ labels={"foo": "bar"},
+ name="test",
+ task_id="task",
+ is_delete_operator_pod=True,
+ keep_failed_pod=True
+ )
+ with self.assertRaises(AirflowException):
+ k.execute(None)
Review comment:
The pod will enter a failed state instantly. We just need to confirm it is
still there after this the `Kubernetes Pod Operator` has gotten past the line
below (which currently deletes all pods regardless of exit code):
https://github.com/apache/incubator-airflow/blob/a8203aa3263656c32ebc2e8090322b08be4e1ded/airflow/contrib/operators/kubernetes_pod_operator.py#L136
In practice waiting a second or two should suffice, or there may be another
way to structure it if you have any ideas?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services