Skip to main content

This module makes it simplely to run things in async.

Project description

async4s - 一个简单易用的异步执行模块

About

这是一个简单易用的异步执行模块,提供几个python装饰器,使原有方法轻松变为异步执行。

Requirements

  • Python3

Install

通过pip命令安装:

pip install async4s

Example

import time

import async4s

# Use 4 threads.
pool = async4s.ThreadPool(max_workers=4)

@async4s.task(pool)
def work():
    time.sleep(3)
    return "Work Done!!!"

@async4s.callback(pool)
def work_callback(work):
    print(work.result())


for i in range(4):
    work()
pool.shutdown()
print("All done")

Release History

0.0.1(2021-01-26)

  • Birth

Author

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

async4s-0.0.3.zip (17.2 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