Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KubernetesPodOperatorAsync pod not killed when task failed from UI #450

Open
RNHTTR opened this issue Jun 17, 2022 · 0 comments
Open

KubernetesPodOperatorAsync pod not killed when task failed from UI #450

RNHTTR opened this issue Jun 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@RNHTTR
Copy link
Contributor

RNHTTR commented Jun 17, 2022

Describe the bug
When setting a KubernetesPodOperatorAsync task that is currently in the deferred state to failed in the UI, the underlying pod will not be killed.

To Reproduce
Deploy the following DAG to Astro:

from datetime import datetime, timedelta

from airflow import DAG
from airflow.configuration import conf
from astronomer.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperatorAsync
from kubernetes.client import models as k8s

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2019, 1, 1),
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

namespace = conf.get('kubernetes', 'NAMESPACE')

dag = DAG("example_kubernetes_pod", schedule_interval="@once", default_args=default_args)

# This is where we define our desired resources.
compute_resources = k8s.V1ResourceRequirements(
    limits={"cpu": "800m", "memory": "3Gi"},
    requests={"cpu": "800m", "memory": "3Gi"}
)

with dag:
    KubernetesPodOperatorAsync(
        namespace=namespace,
        image="alpine",
        cmds=["sh", "-c", "while true; do sleep 30; done;"],
        labels={"foo": "bar"},
        name="airflow-test-pod",
        task_id="task-one",
        in_cluster=True,
        resources=compute_resources,
        is_delete_operator_pod=True,
        get_logs=True,
    )

Trigger the DAG, then mark the task as failed from the UI.

Expected behavior
The task should be set to failed and the pod should be killed.

@RNHTTR RNHTTR added the bug Something isn't working label Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant