Fix dag.test() callbacks missing context["exception"]#66294
Open
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Open
Fix dag.test() callbacks missing context["exception"]#66294Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Vamsi-klu wants to merge 1 commit intoapache:mainfrom
Conversation
The in-process supervisor used by dag.test() did not set context["exception"] before invoking finalize(), so on_failure_callback and on_retry_callback could not read the raised exception in dag.test(), unlike normal subprocess execution. Mirror the subprocess path in task_runner.main() by assigning context["exception"] = error between run() and finalize().
|
@Vamsi-klu |
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.
task_runner.main()(the subprocess path) setscontext["exception"] = errorimmediately afterrun()and beforefinalize()so failure/retry callbacks can read the raised exception from context. The in-process supervisor used bydag.test()did not mirror that contract, soon_failure_callbackandon_retry_callbacksawcontext["exception"]as missing/None when invoked viadag.test(). This patchesInProcessTestSupervisor.start()to mirror the subprocess path.Tests
test_supervisor.py::TestInProcessTestSupervisor::test_start_sets_exception_in_context_before_finalize(parametrized overFAILEDandUP_FOR_RETRY) — verified to fail without the fix and pass with it.dag.test()regression intest_dag.py::TestDag::test_dag_test_failure_callback_receives_exception_in_context.closes: #64568
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.7) following the guidelines