A cluster membership library for modern asyncio Python distributed systems running in Kubernetes
Project description
Migdalor
Migdalor is a cluster membership library for modern asyncio Python distributed systems running in Kubernetes.
Migdalor doesn't require a separate broker (e.g. Redis, etcd, Zookeeper, Chabby, etc) to work, but leverage Kubernetes out-of-the-box capabilities to solve the peer discovery problem.
Features
- 🐍 Modern Asyncio Pythonic API
- 🔦 Brokerless Kubernetes native peer discovery based on headless services
- 🔭 Hooks into membership change events
- 🛠️ Ability to manage membership manually
Installation
pip install midgalor
# or
# poetry add midgalor
# pdm add midgalor
Usage
import migdalor
cluster = migdalor.Cluster(
node_address=(node_address), # the current node address (e.g. 127.0.0.1:8001)
discovery=migdalor.KubernetesServiceDiscovery(service_address=cluster_address), # Kubernetes headless service address (e.g. cluster:8000)
## Callbacks on different events
# nodes_added_handlers=[...]
# nodes_removed_handlers=[...],
## Membership update rate
# update_every_secs=10,
)
await cluster.start()
# You can also add or remove nodes manually if you support that in your protocol
await cluster.add([("127.0.0.1", 8001)])
# await cluster.remove([("127.0.0.1", 8001)])
await cluster.stop()
Midgalor comes with some comprehensive example to help you get started:
- The Party Cluster - An example of using Migdalor to implement peer discovery in Kubernetes cluster
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
migdalor-0.0.3.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file migdalor-0.0.3.tar.gz
.
File metadata
- Download URL: migdalor-0.0.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.6.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf1a79ed7b1c19d76aaa9f3083bc366184594d858c2261a7b42d88c9614178c |
|
MD5 | fec187c07759654ddd3a008c59b173b2 |
|
BLAKE2b-256 | b6164ea7a11fec661ad6faf253208ad73a36434ea3f09b7cd54179904a2c64c0 |
File details
Details for the file migdalor-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: migdalor-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.6.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf28b499ad9e6314fc19ce56466ba5f46089496c95e69fafa9528f742efb5772 |
|
MD5 | a9ed674699fa0036ea5d69c7751df1dd |
|
BLAKE2b-256 | ce3a1273e061e6f75d6e3458315243d867fbd0eac8c2cd8a1738c908d02737f7 |