[v3-3-test] Defer Cadwyn import to keep FastAPI off the Task SDK worker path (#69016)#69029
Merged
jason810496 merged 1 commit intoJun 26, 2026
Merged
Conversation
…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>
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.
(cherry picked from commit 85aa9b6)