Stop sending None callbacks to the Dag processor#69991
Open
Rishabjain999 wants to merge 4 commits into
Open
Conversation
_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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_send_dag_callbacks_to_processorwas called unconditionally for everyDag run in every scheduler loop, passing
Nonewhen the run had nocallback defined. This caused two problems:
A spurious
"callback is empty"debug log fired on every schedulingiteration for every run that was still in progress or had no
callbacks defined. Users enabling
DEBUGlogging misread this asevidence that Dag-level
on_failure_callbackwas silently dropped(reported in DAG-level
on_failure_callbacknever fires #63374).An unnecessary
cached_get_daglookup was performed for runs thatwill never produce a callback.
Fix: Guard the dispatch on
callback_to_runbeing non-Nonesothe method is only called when there is actually a callback to send.
Remove the unused
dagparameter and the misleadingelsebranch fromthe method itself, since all call sites now guarantee a non-
Nonecallback before calling it.
Tests updated:
test_dagrun_callbacks_are_not_added_when_callbacks_are_not_defined:changed from asserting the method was called with
Noneto assertingit was never called.
test_dagrun_callbacks_are_added_when_callbacks_are_defined: updatedcomment to correctly describe what is being verified.
closes: #63374