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

Stats of a dynamic mapped tasks disappear after an automatic retry of a failed task #44245

Closed
2 tasks done
shahar1 opened this issue Nov 21, 2024 · 2 comments · Fixed by #44300
Closed
2 tasks done

Stats of a dynamic mapped tasks disappear after an automatic retry of a failed task #44245

shahar1 opened this issue Nov 21, 2024 · 2 comments · Fixed by #44300
Assignees
Labels
area:core area:dynamic-task-mapping AIP-42 area:webserver Webserver related Issues kind:bug This is a clearly a bug

Comments

@shahar1
Copy link
Contributor

shahar1 commented Nov 21, 2024

Apache Airflow version

2.10.2

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When a task gets expanded dynamically, any retried failed task makes its other stats disappear.

What you think should happen instead?

No response

How to reproduce

import random
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python import PythonOperator # add ".providers.standard" in 3

def random_fail_task(task_id):
    if random.random() < 0.5: 
        raise Exception(f"Task {task_id} failed")
    print(f"Task {task_id} succeeded")


def all_success(task_id):
    print(f"Task {task_id} succeeded")

with DAG(
    dag_id='dynamic_task_expansion',
    start_date=datetime(2023, 1, 1),
    schedule=None,
    catchup=False,
) as dag:

    tasks = PythonOperator.partial(
        task_id='task',
        retries=3, ## Change to 0 for the second coherence check
        retry_delay=timedelta(seconds=10),
        python_callable=random_fail_task, # <- Change to all_success for first coherence checks
    ).expand(op_args=[[i] for i in range(100)])

Coherence checks

  1. When replacing random_fail_task with random_all_success_task , we get the exact number of tasks, all succesful (100):
    image

  2. When we apply retries=0 with random_fail_task the total number of tasks (succesful+failed) is once again 100:
    image

Reproduction

  1. When running the random_fail_task task with retries>=0 - some of the mapped tasks fail and are up for retry:
    image

  2. Immediately when failed tasks are triggered for re-run, some of the other tasks disappear from the UI:
    image

  3. And finally we're left with less tasks than what we started:
    image

When looking the the "Mapped Tasks" tab, all of the tasks still are still there.

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Google Cloud Composer

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@shahar1 shahar1 added kind:bug This is a clearly a bug area:core area:UI Related to UI/UX. For Frontend Developers. area:dynamic-task-mapping AIP-42 labels Nov 21, 2024
@shahar1 shahar1 self-assigned this Nov 21, 2024
@ashb
Copy link
Member

ashb commented Nov 21, 2024

First idea: look at the network inspector and see if the issue is in the API response or just in the presentation of the data

@shahar1
Copy link
Contributor Author

shahar1 commented Nov 22, 2024

First idea: look at the network inspector and see if the issue is in the API response or just in the presentation of the data

Thanks for the tip! It seems like the issue is in the API response.

@shahar1 shahar1 added area:webserver Webserver related Issues and removed area:UI Related to UI/UX. For Frontend Developers. labels Nov 22, 2024
@shahar1 shahar1 changed the title Stats of a dynamically expended task disappear after an automatic retry of a failed task Stats of a dynamic mapped tasks disappear after an automatic retry of a failed task Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core area:dynamic-task-mapping AIP-42 area:webserver Webserver related Issues kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants