Skip to content

Instantly share code, notes, and snippets.

View vinayaksuresh's full-sized avatar
📚

Vinayak Suresh vinayaksuresh

📚
View GitHub Profile
@vinayaksuresh
vinayaksuresh / async.py
Last active July 26, 2021 15:05
Series and Parallel calls via asyncio
import asyncio
import random
from time import time, sleep as _sleep
"""
This gist helps understand the basic implementation of the parallel and series call in python using the asyncio library.
The code demonstrates how to invoke asyncio functions and non-asyncio functions asynchronously.
Note from the below output - the parallel calls will always be completed in the ascending order of the sleep seconds,
where as the series call will be completed in the ascending order of the call id.