Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Task of dag stuck in queued state forever when using kubernetes executor, and triggered with a future execution date #12089

Closed
madcolonel10 opened this issue Nov 4, 2020 · 3 comments
Labels
area:Scheduler including HA (high availability) scheduler kind:bug This is a clearly a bug provider:cncf-kubernetes Kubernetes provider related issues

Comments

@madcolonel10
Copy link

madcolonel10 commented Nov 4, 2020

Airflow version: 1.10.12

import random
import string

import requests
from airflow import DAG
from airflow.contrib.sensors.python_sensor import PythonSensor
from airflow.operators.dummy_operator import DummyOperator
from datetime import datetime

dag = DAG(
    dag_id='newDebugDag',
    description='A simple tutorial DAG',
    schedule_interval=None,
    start_date=datetime(2020, 10, 30, 0, 0)
)

start = DummyOperator(task_id='run_this_first', dag=dag)


def wait_for_approval(dag_run, **context):
    software_id = dag_run.conf.get("softwareId", "Some Software Id")
    print("polling status for softwareId:{}".format(software_id))
    response = requests.get('https://5f8582eec29abd0016190be2.mockapi.io/api/v1/status')
    print(response.json())
    context["task_instance"].xcom_push(key="approverId", value="visardan-" + random.choice(string.ascii_letters))
    return response.json()[0]['status']


wait_for_approval = PythonSensor(
    task_id="wait_for_approval_debug",
    python_callable=wait_for_approval,
    dag=dag,
    poke_interval=30,
    provide_context=True,
    executor_config={"KubernetesExecutor": {"image": "apache/airflow:1.10.12-python3.6"}}
)

start >> wait_for_approval
{
    "run_id":"run-eventId109bnfghak2",
    "conf":{
        "softwareId":"something"
    },
    "execution_date": "2020-11-04 10:38:43" //any future execution date
}

The first task executes fine (dummy start task) but the dag is stuck at second task. I can see the worker pod spun up and getting completed but the task status never gets updated and ui still says queued and dag is always in running state due to this.

Screen Shot 2020-11-04 at 5 02 22 PM

Screen Shot 2020-11-04 at 5 04 47 PM

@madcolonel10 madcolonel10 added the kind:bug This is a clearly a bug label Nov 4, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 4, 2020

Thanks for opening your first issue here! Be sure to follow the issue template!

@madcolonel10 madcolonel10 changed the title Task of dag stuck in queued state forever when using kubernetes executor and triggered with a future execution date Task of dag stuck in queued state forever when using kubernetes executor when triggered with a future execution date Nov 4, 2020
@madcolonel10 madcolonel10 changed the title Task of dag stuck in queued state forever when using kubernetes executor when triggered with a future execution date Task of dag stuck in queued state forever when using kubernetes executor, and triggered with a future execution date Nov 4, 2020
@pageldev
Copy link
Contributor

duplicate of #13542 ? Are you still seeing this in Airflow 2.0 ?

@JieChenAtPonyai
Copy link

JieChenAtPonyai commented Mar 11, 2021

I met a similar issue. After investigation, I find the root cause is the the worker pod does not update the status of task to RUNNING because this dependence RunnableExecDateDep is not met. So this task is stuck in queued state.
I think enabling [allow_trigger_in_future](

allow_trigger_in_future = False
) can resolve it.

@eladkal eladkal added provider:cncf-kubernetes Kubernetes provider related issues area:Scheduler including HA (high availability) scheduler labels Apr 11, 2021
@apache apache locked and limited conversation to collaborators May 28, 2022
@eladkal eladkal converted this issue into discussion #23993 May 28, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
area:Scheduler including HA (high availability) scheduler kind:bug This is a clearly a bug provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

No branches or pull requests

4 participants