Supported engines

AsyncIOEngine

Runs code as asyncio coroutines:

from concurrently import concurrently, AsyncIOEngine

...
@concurrently(2, engine=AsyncIOEngine, loop=loop)  # loop is option
async def fetch_urls():
    ...

await fetch_urls()
class concurrently.AsyncIOEngine(loop: asyncio.base_events.BaseEventLoop = None)
Parameters:loop – specific asyncio loop or use default if None

AsyncIOThreadEngine

Runs code in threads with asyncio:

from concurrently import concurrently, AsyncIOThreadEngine

...
@concurrently(2, engine=AsyncIOThreadEngine, loop=loop)
def fetch_urls():  # not async def
    ...

await fetch_urls()
class concurrently.AsyncIOThreadEngine(loop: asyncio.base_events.BaseEventLoop = None)
Parameters:loop – specific asyncio loop or use default if None

ThreadEngine

Runs code in system threads:

from concurrently import concurrently, ThreadEngine

...
@concurrently(2, engine=ThreadEngine)
def fetch_urls():  # not async def
    ...

fetch_urls()  # not await
class concurrently.ThreadEngine

ProcessEngine

Runs code in system process:

from concurrently import concurrently, ProcessEngine

...
@concurrently(2, engine=ProcessEngine)
def fetch_urls():
    ...

fetch_urls()
class concurrently.ProcessEngine

GeventEngine

Runs code as gevent greenlets:

from concurrently import concurrently, GeventEngine

...
@concurrently(2, engine=GeventEngine)
def fetch_urls():
    ...

fetch_urls()

Note

You must install gevent module for use this engine:

$ pip install concurrently[gevent]
class concurrently.GeventEngine