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 details)

Uploaded Source

File details

Details for the file hapool-0.0.1.tar.gz.

File metadata

  • Download URL: hapool-0.0.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for hapool-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fa08da0598e9be1c239acbf6a7432444daa65d6713062dea8ab4d25ec9781b9a
MD5 b4d1c67961853a3f76cd110dd452aa06
BLAKE2b-256 dde437b61280ce97e97e3abe0b613cda31ad6184251ba3ffcabf13f48ea8408d

See more details on using hashes here.

Supported by

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