Skip to content

Serve logs from scheduler if any executor is LocalExecutor - #71283

Merged
potiuk merged 1 commit into
apache:mainfrom
topherinternational:scheduler-command-serve-logs-local
Aug 18, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
topherinternational:scheduler-command-serve-logs-local

Conversation

@topherinternational

@topherinternational topherinternational commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

This change causes the scheduler to start the local log server if the LocalExecutor is anywhere in the list of configured executors; previously, scheduler would start the log server only if LocalExecutor was the default (first) executor.

In my org, we set up multiple executors on Airflow 2 with the core.executor config set to KubernetesExecutor,LocalExecutor. We put the KubernetesExecutor first 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:

  • Task logs would not display in the UI for running local tasks (logs would display as expected for finished local tasks, and running and finished k8s tasks)
  • Logs in the api-server would show a corresponding Connection refused error trying to connect to the scheduler on port 8793
  • The scheduler was not actually listening on 8793, i.e. the local log server had not been started

I examined the code and found that scheduler_command launches the log server only if LocalExecutor is 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 setup

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

@eladkal eladkal added this to the Airflow 3.3.2 milestone Aug 8, 2026
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Aug 13, 2026
@topherinternational
topherinternational force-pushed the scheduler-command-serve-logs-local branch from d7c15a4 to e7e1115 Compare August 13, 2026 22:29
@potiuk
potiuk merged commit 372b8ed into apache:main Aug 18, 2026
73 checks passed

@potiuk potiuk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 18, 2026
potiuk pushed a commit that referenced this pull request Aug 18, 2026
#71283) (#71781)

(cherry picked from commit 372b8ed)

Co-authored-by: Christopher Anderson <[email protected]>
vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:CLI ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants