ray-project / pygloo

Pygloo provides Python bindings for Gloo.
Apache License 2.0
16 stars 9 forks source link

Support pygloo custom store. #10

Closed jovany-wang closed 2 years ago

jovany-wang commented 2 years ago

In this PR, we support the pygloo custom store, which could help users to implement their custom store instead of the built in stores.

The usage of custom store is:

### 1. Write a store class with `set`, `get` and `wait` methods.
class MyStoreImpl:
    def set(key, data):
        pass
    def get(key) -> bytes:
        pass
    def wait(keys: list):
        pass

# Register to pygloo CustomStore
my_store = MyStoreImpl()
custom_store = pygloo.rendezvous.CustomStore(my_store)
self._context.connectFullMesh(custom_store, dev)

See tests/test_custom_store.py test file for details.