Skip to content

Report a retried Databricks task once, from its last attempt - #72313

Merged
eladkal merged 1 commit into
apache:mainfrom
moomindani:fix-databricks-duplicate-failed-task-errors
Sep 9, 2026
Merged

eladkal merged 1 commit into
apache:mainfrom
moomindani:fix-databricks-duplicate-failed-task-errors

Conversation

@moomindani

Copy link
Copy Markdown
Contributor

A Databricks run carries one entry per task attempt. extract_failed_task_errors[_async] walked every entry, so the failure list that ends up in a task's error message (operators/databricks.py:159, and the trigger event on the deferrable path) had two problems:

  • a task that Databricks retried was reported once per attempt, and get_run_output was called once per attempt as well
  • a task that failed on an earlier attempt but succeeded on the retry was still reported as failed

Both go away by keeping only the attempt with the highest attempt_number per task_key before filtering for failures.

The semantics I picked, in case anyone wants to argue for the other one: report the last attempt only. An earlier attempt's error does not describe the outcome of the task, and if the retry succeeded there is no failure to report at all. Deduplicating by task_key while keeping the first entry would fix the duplication but keep reporting recovered tasks as failures.

Verified against a live workspace, with a job whose single task always fails and carries max_retries: 1:

  • the API returns two entries for that task — attempt_number 0 and 1, both FAILED, with different task run ids
  • after the change extract_failed_task_errors returns exactly one entry, carrying the last attempt's run id

All three new unit tests fail without the change, and the provider's unit suite passes with it.

related: #72304


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

A run carries one entry per task attempt, so the failure list that reaches
a task's error message repeated a retried task once per attempt, and it
also listed tasks that had failed on an earlier attempt but succeeded on
the retry. Only the outcome of the last attempt describes what happened.
@moomindani

Copy link
Copy Markdown
Contributor Author

@eladkal could you take a look when you have a moment, or point it at whoever is better placed?

A run carries one entry per task attempt, so a retried task is reported once per attempt, and a task that failed on an earlier attempt but succeeded on the retry is still reported as failed. Green, and verified against a live workspace.

Note that #70385 edits the same two lines, so whichever lands second needs a trivial rebase.


Drafted-by: Claude Code (Opus 5); reviewed by @moomindani before posting

@eladkal
eladkal merged commit 9326946 into apache:main Sep 9, 2026
83 checks passed
imrichardwu pushed a commit to imrichardwu/airflow that referenced this pull request Sep 11, 2026
…72313)

A run carries one entry per task attempt, so the failure list that reaches
a task's error message repeated a retried task once per attempt, and it
also listed tasks that had failed on an earlier attempt but succeeded on
the retry. Only the outcome of the last attempt describes what happened.
xvega pushed a commit to xvega/airflow that referenced this pull request Sep 13, 2026
…72313)

A run carries one entry per task attempt, so the failure list that reaches
a task's error message repeated a retried task once per attempt, and it
also listed tasks that had failed on an earlier attempt but succeeded on
the retry. Only the outcome of the last attempt describes what happened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants