Python client for the Serf orchestration tool
Project description
asyncserf is an async Python interface to Serf, the decentralised solution for service discovery and orchestration.
It uses anyio <https://github.com/agronholm/anyio> as its underlying async framework.
Installation
asyncserf requires a running Serf agent. See Serf’s agent documentation for instructions.
To install asyncserf, run the following command:
$ pip install asyncserf
or alternatively (you really should be using pip though):
$ easy_install asyncserf
or from source:
$ python setup.py install
Getting Started
These examples require a running async loop. Trio <https://github.com/python-trio/trio> is recommended, though asyncio works too.
Sending a message is easy:
from asyncserf import serf_client async with serf_client() as client: await client.event('foo', b'bar')
So is receiving:
.. code-block:: python
from asyncserf import serf_client
- async with serf_client() as client:
- async with client.stream(‘foo’) as stream:
- async for resp in stream:
print(resp.payload)
Development
You can run the tests using the following commands:
$ serf agent --tag foo=bar & # start serf agent
$ python3 -mpytest tests
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
File details
Details for the file asyncserf-0.16.2.tar.gz
.
File metadata
- Download URL: asyncserf-0.16.2.tar.gz
- Upload date:
- Size: 33.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d36bc1a01f4efd75cf573743794542bd70607a61baf3b5979e45fc5699e2004e |
|
MD5 | 513cd5f5eb27b8941c3ef6a89b961239 |
|
BLAKE2b-256 | 4bbebc64125a92acb97adebc2f4459dd889801952889808dd4357023aa43f213 |