https://github.com/wwoods/dask-actor-singleton
Provides a means of allocating and accessing singleton actors in dask by name.
https://github.com/wwoods/dask-actor-singleton
Last synced: 7 months ago
JSON representation
Provides a means of allocating and accessing singleton actors in dask by name.
- Host: GitHub
- URL: https://github.com/wwoods/dask-actor-singleton
- Owner: wwoods
- License: mit
- Created: 2021-07-19T15:49:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-14T23:36:09.000Z (about 2 years ago)
- Last Synced: 2025-02-21T19:03:15.964Z (8 months ago)
- Language: Python
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
dask-actor-singleton
====================This package works around common transient errors and pitfalls in creating a singleton instance of an [Actor](https://distributed.dask.org/en/latest/actors.html) in [Dask](https://docs.dask.org/en/latest/). It provides a clean interface for retrieving the singleton instance, and allocating it when necessary.
Usage
-----```python
import dask_actor_singletonclass MyActor:
def __init__(self, arg):
self.value = arg
def inc(self):
self.value += 1
return self.valueclient = 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
-------
* 2023-09-14 v1.3.4 release. Fixing compatibility with Dask 2023.5.0 and beyond, and the [FAW](https://github.com/GaloisInc/FAW).
* 2021-08-19 v1.3.3 release. Caching times start after object creation finishes; not at the start. This matters for objects with long load times.
* 2021-08-18 v1.3.2 release. Explicitly forget wrapped future.
* 2021-08-18 v1.3.1 release. Free old actor when re-allocating to potentially reduce memory load.
* 2021-08-02 v1.3.0 release. Priority argument added to improve responsiveness alongside larger processing loads.
* 2021-07-29 v1.2.0 release. Added TTL support for `get`, and better documentation for `discard`.
* 2021-07-29 v1.1.1 release. Fixed issue with "Working holding Actor was lost"
* 2021-07-29 v1.1 release. Supports `discard` to purge a cached singleton.
* 2021-07-19 v1.0 release.