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


Tihs pacakage provides an async, concurrent.futures.Executor compliant, android compatible process pool.

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.2.tar.gz (4.1 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.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aio_process_pool-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d5dc0dd2e13e0bda69f15b2a19cb255dc4a90604d8efc9a63dbd119a3fd8bc42
MD5 4edd6354858d115ce7a42b6c252c9957
BLAKE2b-256 59b1d54c661dd615c09378432a06e09cad8a0e3a3f6600ba018195a280db9e81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aio_process_pool-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9fd3775915040625a7bc26f6060b63cf0b7b1a7c4ce6aec95699798c24f1c560
MD5 58ab3e20590fcb88442bae3dd926c96c
BLAKE2b-256 f302f41a3bb101a2d83eb5af9320cd5cd63c0eb4210f7e937e73e445ae36575a

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