From bcbe94f6038c25b578f2bf4c68f8eeb6f748442c Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Thu, 16 Jan 2025 17:59:51 +0000 Subject: [PATCH] Add missing python-fetch-individual-packages autogate check. --- src/workerd/server/workerd-api.c++ | 3 ++- src/workerd/util/autogate.c++ | 2 ++ src/workerd/util/autogate.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/workerd/server/workerd-api.c++ b/src/workerd/server/workerd-api.c++ index b574b84ecb5..da2768139a7 100644 --- a/src/workerd/server/workerd-api.c++ +++ b/src/workerd/server/workerd-api.c++ @@ -565,7 +565,8 @@ void WorkerdApi::compileModules(jsg::Lock& lockParam, jsg::ModuleRegistry::Type::INTERNAL); // Inject packages tar file - if (featureFlags.getPythonExternalPackages()) { + if (featureFlags.getPythonExternalPackages() || + util::Autogate::isEnabled(util::AutogateKey::PYTHON_FETCH_INDIVIDUAL_PACKAGES)) { modules->addBuiltinModule("pyodide-internal:packages_tar_reader", "export default { }"_kj, workerd::jsg::ModuleRegistry::Type::INTERNAL, {}); } else { diff --git a/src/workerd/util/autogate.c++ b/src/workerd/util/autogate.c++ index c5264a9fa03..49e0bf03ab0 100644 --- a/src/workerd/util/autogate.c++ +++ b/src/workerd/util/autogate.c++ @@ -19,6 +19,8 @@ kj::StringPtr KJ_STRINGIFY(AutogateKey key) { return "test-workerd"_kj; case AutogateKey::STREAMING_TAIL_WORKERS: return "streaming-tail-workers"_kj; + case AutogateKey::PYTHON_FETCH_INDIVIDUAL_PACKAGES: + return "python-fetch-individual-packages"; case AutogateKey::NumOfKeys: KJ_FAIL_ASSERT("NumOfKeys should not be used in getName"); } diff --git a/src/workerd/util/autogate.h b/src/workerd/util/autogate.h index f44f2193147..51dc29e63d0 100644 --- a/src/workerd/util/autogate.h +++ b/src/workerd/util/autogate.h @@ -15,6 +15,9 @@ namespace workerd::util { enum class AutogateKey { TEST_WORKERD, STREAMING_TAIL_WORKERS, + // Fetches Python packages as individual bundles from GCS instead of using a single big bundle + // embedded in the binary + PYTHON_FETCH_INDIVIDUAL_PACKAGES, NumOfKeys // Reserved for iteration. };