serf编排工具的python客户端
aioserf的Python项目详细描述
aioserf是一个到serf的异步python接口,serf是一个分散的解决方案。 用于服务发现和编排
它使用anyio<;https://github.com/agronholm/anyio>;,因此应该与 asyncio、trio和curio有希望地。
安装
aioserf需要一个正在运行的农奴代理有关说明,请参见Serf’s agent documentation
要安装aioserf,请运行以下命令:
$ pip install aioserf
或者(您确实应该使用pip):
$ easy_install aioserf
或来源:
$ python setup.py install
开始
这些示例需要运行异步循环。 Trio<;建议使用https://github.com/python Trio/Trio>;asyncio也可以。
fromaioserfimportserf_clientasyncwithserf_client()asclient:awaitclient.event('foo','bar')
流使用:
fromaioserfimportserf_clientasyncwithserf_client()asclient:asyncwithclient.stream('*')asstream:asyncforrespinstream:print(resp)
开发
aioserf需要一个正在运行的农奴代理。有关说明,请参见Serf’s agent documentation。
可以使用以下命令运行测试:
$ serf agent --tag foo=bar &# start serf agent $ python3 -mpytest tests