-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
featureNew feature or capabilityNew feature or capability
Milestone
Description
Summary
Add a namespace parameter to the @wool.routine decorator that controls a task's access to global variables on a given worker. Default to a unique, isolated namespace per task invocation to prevent global state leakage between unrelated tasks.
Provide three modes:
None(default): unique, isolated namespace per invocation- Named string (e.g.,
"cached"): shared globals with other tasks using the same namespace key wool.WORKERsentinel: opt into the previous behavior (shared worker globals)
Motivation
All routine tasks currently share the worker's global namespace. This causes global state to leak between unrelated tasks, making behavior unpredictable and preventing safe concurrent execution of tasks that rely on mutable globals. Namespace isolation with ephemeral state as the default enables safe concurrent execution while providing opt-in mechanisms for intentional state sharing when needed (e.g., @lru_cache).
Affected code
wool/src/wool/runtime/routine/task.py— task deserialization and namespace managementwool/src/wool/runtime/routine/wrapper.py— decorator and namespace parameter handlingwool/src/wool/__init__.py— exportWORKERsentinelwool/protobuf/task.proto— addnamespacefield to protobuf schema
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or capabilityNew feature or capability