Repository navigation
Serve logs from scheduler if any executor is LocalExecutor - #71283
Conversation
d7c15a4 to
e7e1115
Compare
There was a problem hiding this comment.
LGTM — genuine hybrid-executor bug. With KubernetesExecutor,LocalExecutor the default is Kubernetes, so serve_logs came back False and the scheduler never served logs for the LocalExecutor tasks running on its own host.
Verified the mechanics: get_executor_names() → import_executor_cls() is the right pairing and the [0] unpack matches the returned tuple. I also checked this doesn't add a database round-trip at scheduler startup — get_executor_names() validates team names by default, but the old get_default_executor_name() path called _get_executor_names() with the same defaults, so the cost is unchanged.
The ("KubernetesExecutor,LocalExecutor", True) case is the one that fails without the fix; good regression test.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.
Backport successfully created: v3-3-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
apache#71283) (cherry picked from commit 372b8ed) Co-authored-by: Christopher Anderson <[email protected]>
#71283) (#71781) (cherry picked from commit 372b8ed) Co-authored-by: Christopher Anderson <[email protected]>
#71283) (#71781) (cherry picked from commit 372b8ed) Co-authored-by: Christopher Anderson <[email protected]>
This change causes the scheduler to start the local log server if the
LocalExecutoris anywhere in the list of configured executors; previously, scheduler would start the log server only ifLocalExecutorwas the default (first) executor.In my org, we set up multiple executors on Airflow 2 with the
core.executorconfig set toKubernetesExecutor,LocalExecutor. We put theKubernetesExecutorfirst as a fail-safe - in the event a task runs without specifying an executor, we want it to run in an isolated pod so it doesn't threaten resources on the scheduler or its locally-running tasks.After we upgraded to Airflow 3, we noticed:
Connection refusederror trying to connect to the scheduler on port 8793I examined the code and found that
scheduler_commandlaunches the log server only ifLocalExecutoris the default executor (i.e., the first executor listed in the configuration).This PR solves the issue by examining all configured executor types instead of only the default when deciding whether to launch the log server.
I've added two test cases to the existing parameterized
TestSchedulerCommand.test_serve_logs_on_scheduler()method:"LocalExecutor,KubernetesExecutor"passes before and after this fix, showing that the log server is launched when the local executor is the default in a multiple-executor setup"KubernetesExecutor,LocalExecutor"fails before this fix and passes after it, showing that the log server is launched when the local executor is non-default in a multiple-executor setupWas generative AI tooling used to co-author this PR?