Skip to content

[v3-3-test] Defer Cadwyn import to keep FastAPI off the Task SDK worker path (#69016)#69029

Merged
jason810496 merged 1 commit into
apache:v3-3-testfrom
jason810496:backport-85aa9b6-v3-3-test
Jun 26, 2026
Merged

[v3-3-test] Defer Cadwyn import to keep FastAPI off the Task SDK worker path (#69016)#69029
jason810496 merged 1 commit into
apache:v3-3-testfrom
jason810496:backport-85aa9b6-v3-3-test

Conversation

@jason810496

Copy link
Copy Markdown
Member

(cherry picked from commit 85aa9b6)

…er path (apache#69016)

The Task SDK supervisor imports the execution-time schema package on every
worker, and that package imported cadwyn at module load. cadwyn pulls in
FastAPI, Starlette and Jinja2, which are only needed on the foreign-language-SDK
schema-migration path and never for a pure-Python worker. Because the supervisor
is imported lazily after the Celery prefork, each pool worker paid this import
in private (non copy-on-write) pages, raising worker memory on Python 3.14.

Defer the cadwyn import behind a cached bundle accessor and into _versioned_class
so importing the schema package no longer loads FastAPI. The foreign-SDK path is
unchanged; a regression test asserts the worker import graph stays cadwyn-free.
(cherry picked from commit 85aa9b6)

Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
@jason810496 jason810496 self-assigned this Jun 26, 2026
@jason810496 jason810496 added this to the Airflow 3.3.0 milestone Jun 26, 2026
@jason810496 jason810496 merged commit c5bc750 into apache:v3-3-test Jun 26, 2026
176 of 177 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant