Repository navigation
Make Edge executor adoption test immune to executor_loader reloads - #74122
Merged
henry3260 merged 1 commit intoOct 3, 2026
Merged
Conversation
The scheduler-restart adoption test patched ExecutorLoader.init_executors through the airflow.executors.executor_loader module path. Tests in other providers (cncf.kubernetes, celery) call importlib.reload() on that module, which replaces the ExecutorLoader class object there while the module that builds the scheduler's executors keeps the original class. When those providers run in the same pytest process before edge3, the patch lands on the new class, the scheduler resolves executors through the old one and picks up the leaked KubernetesExecutor name cache, and the test fails with "'NoneType' object has no attribute 'api_client'". Patch the class object on the module that actually calls init_executors(), which differs between Airflow 3.0/3.1 (Job) and 3.2+ (SchedulerJobRunner).
shahar1
requested review from
dheerajturaga,
jscheffl and
shubhamraj-git
as code owners
October 2, 2026 19:57
1 task done
SameerMesiah97
approved these changes
Oct 2, 2026
1 task done
aaron-y-chen
approved these changes
Oct 2, 2026
FrankYang0529
approved these changes
Oct 2, 2026
1 task done
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.
A test from #73832 started to fail suddenly - it didn't surface in the PR due to a bug in the selective checks.
This PR fixes the test, I'll handle the selective checks separately.
AI Summary
test_scheduler_restart_adopts_queued_edge_task(added in #73832) fails when thecncf.kubernetesandedge3test suites run in the same pytest process, which is how CI groups them:Tests in other providers (
cncf.kubernetes,celery) callimportlib.reload()onairflow.executors.executor_loader. That replaces theExecutorLoaderclass object in the module, while the module that builds the scheduler's executors keeps the class it imported at startup. The edge3 test patchedinit_executorsthrough the module path, so the patch landed on the new class, the scheduler resolved executors through the original one, picked up the executor-name cache those tests leave populated withKubernetesExecutor, and called into an unstarted Kubernetes executor.The test now patches
init_executorson the class object held by the module that actually calls it:airflow.jobs.jobon Airflow 3.0/3.1 andairflow.jobs.scheduler_job_runneron 3.2+ (the edge3 compat matrix covers 3.0.6, 3.1.8, 3.2.2 and 3.3.2).Test-only change. The shipped
edge_executor.pyfix from #73832 is unaffected and works as released. Not fixing the leaking reloads incncf.kubernetes/celerytests here; replacing thosereload()calls with theclean_executor_loaderfixture is a separate cleanup.Verified locally with
breeze testing providers-tests --test-type "Providers[cncf.kubernetes,edge3]": the test fails onmainand passes with this change.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5.1) following the guidelines