-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Labels
enhancementNew features or improvements to existing functionalityNew features or improvements to existing functionality
Milestone
Description
Describe the Request
Using ProxyStore with a concurrent.futures.Executor compatible interface is pretty common. We could provide our own wrapper with auto-proxying support based on a threshold or filter mechanism.
In the below example, the user provides a should_proxy function. We could provide a set of these with the following functionality:
- Always proxy
- Proxy based on
sys.getsizeof()threshold (faster, but not always accurate) - Proxy based on serialized size (accurate, but might result in double-serialization)
- Proxy if type is in user-provided list of types
Sample Code
class ProxyExecutor(concurrent.futures.Executor):
def __init__(
executor: concurrent.futures.Executor,
store: Store[Any],
should_proxy: Callable[[Any], bool],
) -> None:
self.executor = executor
self.store = store
...
def submit(...) -> ...:
# Proxy args/kwargs based on should_proxy check.
# Wrap function in a decorator that will proxy result
# based on should_proxy check.
fut = self.executor.submit(...)
return futMetadata
Metadata
Assignees
Labels
enhancementNew features or improvements to existing functionalityNew features or improvements to existing functionality