Helper library to allocate and retrieve singleton actors in Dask
Project description
dask-actor-singleton
This package works around common transient errors and pitfalls in creating a singleton instance of an Actor in Dask. It provides a clean interface for retrieving the singleton instance, and allocating it when necessary.
Usage
import dask_actor_singleton
class MyActor:
def __init__(self, arg):
self.value = arg
def inc(self):
self.value += 1
return self.value
client = dask.distributed.Client()
actor = dask_actor_singleton.get('my_actor', create=lambda: MyActor(8))
print(actor.inc().result()) # 9
# Now, on a different computer / dask.distributed.Client, run this script again:
# ...
print(actor.inc().result()) # 10
# If ever the singleton should be deleted, one may call:
dask_actor_singleton.discard('my_actor')
History
- 2021-07-29 v1.1 release. Supports
discard
to purge a cached singleton. - 2021-07-19 v1.0 release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for dask-actor-singleton-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19bd2ca4f37301ad6c67cad06e197179f2d6d48da61520636fd0a5ec0d8846af |
|
MD5 | bee2ff30a336e24dff5b2de1c6fd6c3c |
|
BLAKE2b-256 | 00965c1fc907003f6a444e5d0dea2cefa0ba96e171bcaf637885eed0769bfa05 |