Skip to main content

Migdalor - a Kubernetes native cluster management for modern Python

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

Metadata

Release files for migdalor 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for migdalor 0.0.3
File Size Uploaded
migdalor-0.0.3.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for migdalor 0.0.3
File Interpreter ABI Platform
migdalor-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / migdalor-0.0.3.tar.gz

Download URL migdalor-0.0.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fcf1a79ed7b1c19d76aaa9f3083bc366184594d858c2261a7b42d88c9614178c
BLAKE2b-256 checksum
How to use checksums
b6164ea7a11fec661ad6faf253208ad73a36434ea3f09b7cd54179904a2c64c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.6.1 CPython/3.11.3

Release files / migdalor-0.0.3-py3-none-any.whl

Download URL migdalor-0.0.3-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf28b499ad9e6314fc19ce56466ba5f46089496c95e69fafa9528f742efb5772
BLAKE2b-256 checksum
How to use checksums
ce3a1273e061e6f75d6e3458315243d867fbd0eac8c2cd8a1738c908d02737f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.6.1 CPython/3.11.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page