Skip to content

Stop sending None callbacks to the Dag processor#69991

Open
Rishabjain999 wants to merge 4 commits into
apache:mainfrom
Rishabjain999:fix/dag-failure-callback-noise
Open

Stop sending None callbacks to the Dag processor#69991
Rishabjain999 wants to merge 4 commits into
apache:mainfrom
Rishabjain999:fix/dag-failure-callback-noise

Conversation

@Rishabjain999

@Rishabjain999 Rishabjain999 commented Jul 17, 2026

Copy link
Copy Markdown

_send_dag_callbacks_to_processor was called unconditionally for every
Dag run in every scheduler loop, passing None when the run had no
callback defined. This caused two problems:

  1. A spurious "callback is empty" debug log fired on every scheduling
    iteration for every run that was still in progress or had no
    callbacks defined. Users enabling DEBUG logging misread this as
    evidence that Dag-level on_failure_callback was silently dropped
    (reported in DAG-level on_failure_callback never fires #63374).

  2. An unnecessary cached_get_dag lookup was performed for runs that
    will never produce a callback.

Fix: Guard the dispatch on callback_to_run being non-None so
the method is only called when there is actually a callback to send.
Remove the unused dag parameter and the misleading else branch from
the method itself, since all call sites now guarantee a non-None
callback before calling it.

Tests updated:

  • test_dagrun_callbacks_are_not_added_when_callbacks_are_not_defined:
    changed from asserting the method was called with None to asserting
    it was never called.
  • test_dagrun_callbacks_are_added_when_callbacks_are_defined: updated
    comment to correctly describe what is being verified.

closes: #63374

_send_dag_callbacks_to_processor was called unconditionally for every
Dag run in every scheduler loop, passing None when the run had no
callback defined. This caused two problems:

- A spurious "callback is empty" debug log on every scheduling
  iteration for every run that was still in progress or had no
  callbacks defined, which users misread as evidence of a bug.
- An unnecessary DAG serialization lookup (cached_get_dag) for runs
  that will never produce a callback.

Guard the dispatch on callback_to_run being non-None so the method is
only called when there is actually a callback to send. Remove the
unused dag parameter and the misleading else branch from the method
itself now that all callers guarantee a non-None callback.

closes: apache#63374
@boring-cyborg boring-cyborg Bot added the area:Scheduler including HA (high availability) scheduler label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAG-level on_failure_callback never fires

2 participants