معرفی شرکت ها


asyncbg-0.9.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Asyncio background tasks.
ویژگی مقدار
سیستم عامل -
نام فایل asyncbg-0.9.0
نام asyncbg
نسخه کتابخانه 0.9.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Erik Moqvist
ایمیل نویسنده erik.moqvist@gmail.com
آدرس صفحه اصلی https://github.com/eerimoq/asyncbg
آدرس اینترنتی https://pypi.org/project/asyncbg/
مجوز MIT
|buildstatus|_ |coverage|_ Asyncio background tasks ======================== Asyncio background tasks in Python 3.7 and later. Run CPU intensive long running tasks without blocking the asyncio loop, implemented as a lightweight asyncio layer on top of the multiprocessing module. Alternatively run tasks in other threads. Project homepage: https://github.com/eerimoq/asyncbg Documentation: https://asyncbg.readthedocs.org/en/latest Installation ============ .. code-block:: python pip install asyncbg Examples ======== There are more examples in the `examples folder`_. Call ---- Call ``work(a, b)`` in another process. The script output is ``Result: 9``. .. code-block:: python import asyncio import asyncbg def work(a, b): return a + b async def main(): result = await asyncbg.call(work, 4, 5) print(f'Result: {result}') asyncio.run(main()) Process pool ------------ Create a process pool with two workers, and call ``work()`` three times in it (up to two callbacks called in parallel). .. code-block:: python import asyncio import asyncbg def work(): pass async def main(): with asyncbg.ProcessPoolExecutor(max_workers=2) as pool: await asyncio.gather(pool.call(work), pool.call(work), pool.call(work)) asyncio.run(main()) Call thread ----------- Call ``work(a, b)`` in another thread. The script output is ``Result: 9``. .. code-block:: python import asyncio import asyncbg def work(a, b): return a + b async def main(): result = await asyncbg.call_thread(work, 4, 5) print(f'Result: {result}') asyncio.run(main()) Thread pool ----------- Create a thread pool with two workers, and call ``work()`` three times in it (up to two callbacks called in parallel). .. code-block:: python import asyncio import asyncbg def work(): pass async def main(): with asyncbg.ThreadPoolExecutor(max_workers=2) as pool: await asyncio.gather(pool.call(work), pool.call(work), pool.call(work)) asyncio.run(main()) .. |buildstatus| image:: https://travis-ci.org/eerimoq/asyncbg.svg?branch=master .. _buildstatus: https://travis-ci.org/eerimoq/asyncbg .. |coverage| image:: https://coveralls.io/repos/github/eerimoq/asyncbg/badge.svg?branch=master .. _coverage: https://coveralls.io/github/eerimoq/asyncbg .. _examples folder: https://github.com/eerimoq/asyncbg/tree/master/examples


نحوه نصب


نصب پکیج whl asyncbg-0.9.0:

    pip install asyncbg-0.9.0.whl


نصب پکیج tar.gz asyncbg-0.9.0:

    pip install asyncbg-0.9.0.tar.gz