Skip to main content

A handy, customizable python library that provides high availability for multiple node connections

Project description

pyhapool

A handy, customizable python library that provides high availability(including failover etc.) for multiple node connections.

Install

pip install hapool

QuickStart

For example, we need to connect to multiple kubernetes apiserver.

from pyhapool import HAEndpointPool
from kubernetes.client import ApiClient

# got configuration list which contain multiple apiservers
configuration_list = [...]
ha_pool = HAEndpointPool.from_list(configuration_list)


class HAApiClient(ApiClient):

    def call_api(self, *args, **kwargs):
        while ha_pool.data:
            with ha_pool.get_endpoint() as configuration:
                self.configuration = configuration
                return super().call_api(*args, **kwargs)

If any apiserver became unavailable (may raise some exceptions), ha_pool would switch to next endpoint until any available one been chosen(work like upstream in nginx).


more documentation is coming.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hapool-0.0.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page