Skip to content

Fix task instance tries API returning duplicate entries for same task instance #50597

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

Merged
merged 4 commits into from
May 15, 2025

Conversation

vatsrahul1001
Copy link
Contributor

@vatsrahul1001 vatsrahul1001 commented May 14, 2025

This PR fixes an issue where the task_instance_tries query could return duplicate rows for the same task instance. The problem was caused by insufficient join conditions between the TaskInstanceHistory and the DagRun table.

Previously, the join used was not sufficient when multiple DAGs may use the same run_id. This led to incorrect joins and duplicate results when querying task tries for a specific task instance.

image

closes: #50593


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label May 14, 2025
@vatsrahul1001 vatsrahul1001 changed the title fix task instance try endpoint query Fix task instance tries API returning duplicate entries for same task instance May 14, 2025
@vatsrahul1001 vatsrahul1001 self-assigned this May 14, 2025
@pierrejeambrun pierrejeambrun added this to the Airflow 3.0.2 milestone May 14, 2025
@pierrejeambrun pierrejeambrun added the type:bug-fix Changelog: Bug Fixes label May 14, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks. good catch

@pierrejeambrun pierrejeambrun added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label May 14, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks

@pierrejeambrun pierrejeambrun merged commit 50f0fef into apache:main May 15, 2025
95 checks passed
@pierrejeambrun pierrejeambrun deleted the fix-task-instance-try-endpoint branch May 15, 2025 14:38
Copy link

Backport failed to create: v3-0-test. View the failure log Run details

Status Branch Result
v3-0-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 50f0fef v3-0-test

This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

@pierrejeambrun
Copy link
Member

Changed milestone to 3.1.0 because this PR depends on the relationship and loading options introduced in #49641

sanederchik pushed a commit to sanederchik/airflow that referenced this pull request Jun 7, 2025
… instance (apache#50597)

* fix task instance try endpoint query

* updating TIH model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple retries are appearing on the UI when a DAG run is cleared, and other DAGs also have same duration dagruns available
3 participants