Skip to main content

An async, concurrent.futures.Executor compliant, android compatible process pool implementation

Project description

aio_process_pool

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install aio_process_pool

Usage

from aio_process_pool import AsyncProcessPool


def foo(x):
    return x


# Note:
# - the process pool must be initialize AFTER all functions that are supposed
#   to be called are defined
# - it's not save to initialize a process pool from a multithreaded process
#   because it's based on `os.fork` / `multiprocessing.Process`
pool = AsyncProcessPool()


async def using_run():
    return await pool.run(foo, 72)


async def using_submit():
    future = pool.submit(foo, 73)
    return await future


async def using_executor():
    from functools import partial

    loop = asyncio.get_event_loop()
    return await loop.run_in_executor(pool, partial(foo, 74))

License

aio_process_pool is distributed under the terms of the MIT license.

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

aio_process_pool-0.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aio_process_pool-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file aio_process_pool-0.0.1.tar.gz.

File metadata

  • Download URL: aio_process_pool-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for aio_process_pool-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cc83d1192ed0cd9fb43dc35a8f3e3ffa4131140df0b691d55b9456c59f3a2073
MD5 7a54012286fd3b7d986b5ff4955af7b1
BLAKE2b-256 c79eefa7f8a6d2438e7051d7e3aaf715f3058f231d9d59541b26b698e49676f5

See more details on using hashes here.

File details

Details for the file aio_process_pool-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aio_process_pool-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 106849d162415360216b5ead92caa71d9efbe8819dca882974ee06543091ebf8
MD5 9fa766db979934620a135bed9fd4fd03
BLAKE2b-256 7c6578cc4ba25ca9ee40ab7b94b0a83575acc856b158844a3bb10e69f7a1eb68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page