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

Uploaded Source

File details

Details for the file async4s-0.0.3.zip.

File metadata

  • Download URL: async4s-0.0.3.zip
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.7

File hashes

Hashes for async4s-0.0.3.zip
Algorithm Hash digest
SHA256 5c8a5adedd1bb03c3066c9b43c03edc71abfe01f67fed033359b844d1579abbe
MD5 8bc0329a67c731fa61f4ca4a3a82dd9c
BLAKE2b-256 2dbb9cef470c135f3daea2e13220c8e2d39e349b1e0743325ea7c07a5f1adf34

See more details on using hashes here.

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