acoustic-carpenter-78188
09/09/2025, 5:14 AMnest_asyncio library to nest async code into sync code
import asyncio
import nest_asyncio
import flyte
env = flyte.TaskEnvironment(
"asyncclient_sync",
image=flyte.Image.from_debian_base().with_pip_packages("aiohttp", "nest_asyncio"),
)
nest_asyncio.apply()
async def async_in_sync() -> str:
await asyncio.sleep(1)
return "done"
@env.task
def call_async() -> str:
return asyncio.run(async_in_sync())
flyteorg/flyte-sdkacoustic-carpenter-78188
09/11/2025, 1:27 PM