-
Notifications
You must be signed in to change notification settings - Fork 431
Implements dedicated snapshots for Python Workers. #4699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1aeb0dd
to
d527488
Compare
The generated output of |
06ea785
to
0b7088f
Compare
014ba2b
to
26fad91
Compare
26fad91
to
d82d47f
Compare
acc51f9
to
0c15b23
Compare
The worst case I can think of for this is: from js import Proxy, Object
p = Proxy.revocable(Object.new(), Object.new())
p.revoke()
q = p.proxy
del p but this seems to mess up Pyodide's code too. |
Opened upstream PR to fix: |
Suggested change to test this new flag against all current workerd tests: diff --git a/build/python_metadata.bzl b/build/python_metadata.bzl
index 82b812a37..b8385e6b6 100644
--- a/build/python_metadata.bzl
+++ b/build/python_metadata.bzl
@@ -80,7 +80,10 @@ def _make_bundle_version_info(versions):
if name != "development":
entry["id"] = _bundle_id(**entry)
entry["feature_flags"] = [entry["flag"]]
- entry["feature_string_flags"] = [entry["enable_flag_name"]]
+ string_flags = [entry["enable_flag_name"]]
+ if entry["pyodide_version"] != "0.26.0a2":
+ string_flags.append("python_dedicated_snapshot")
+ entry["feature_string_flags"] = string_flags
if "packages" in entry:
entry["packages"] = entry["packages"]["info"]["tag"]
_add_integrity(entry) |
What happens if this is turned on with 0.26.0a2? Presumably we should bail out early? |
0c15b23
to
de28394
Compare
Even better I think I can use |
30219b2
to
8c9b44f
Compare
8c9b44f
to
a825bb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
a825bb1
to
2ebc17c
Compare
2ebc17c
to
bcacdfd
Compare
bcacdfd
to
b97bbab
Compare
This PR implements dedicated memory snapshot support in Python Workers. These dedicated snapshots are intended to be returned via the validator and then stored in the WorkerBundle.
Run down of features this PR implements:
experimental
which enables code paths to generate and load dedicated snapshots.new exceptionsImplements error types for Python runtime and PyodideEntrypointHelper. #4746PythonRuntimeError
andPythonUserError
to help us distinguish between internal errors in our runtime code and user code errorstype for pyodide_entrypoint_helperImplements error types for Python runtime and PyodideEntrypointHelper. #4746