欢迎使用aio parallel tools!

最近修改: 2019 年 11 月 11 日

选择语言: zh | en

简介

用于方便构建异步程序的工具集.

keywords: tools,asyncio

特点

  • 任务池

  • Actor和全局Actor管理器

例子

async with AioFixedTaskPoolSimple() as task_pool:
    print(f"test pool size {task_pool.size}")
    print("test 4 task with pool size 3")
    await asyncio.gather(
        task_pool.submit(test, func_args=["c"]),
        task_pool.submit(test, func_args=["b"]),
        task_pool.submit(test, func_args=["a"]),
        task_pool.submit(test, func_args=["d"])
    )

class Pinger(AioActor):
    async def receive(self, message):
        print(message)
        try:
            await ActorManager.get_actor("Ponger").Send('ping')
        except Exception as e:
            print(f"receive run error {e}")
        finally:
            await asyncio.sleep(0.5)

安装

  • python -m pip install aio_parallel_tools

版本更迭记录

version 0.0.1

  • 创建了项目