https://pulumi.com logo
#automation-api
Title
# automation-api
b

breezy-table-35227

12/22/2021, 6:35 PM
Hello, is there a way to make an asyncio task for things like
Stack.up()
? We’re trying to use an asyncio HTTP framework (aiohttp) and would really like to run those as a task without blocking the http response
e

elegant-window-55250

12/22/2021, 7:34 PM
So, am I guessing right that you want to build a API which triggers
stack.up()
and returns HTTP response before
stack.up()
is ready?
b

breezy-table-35227

12/22/2021, 7:37 PM
yep correct. i was hoping there’s a way to expose an underlying coroutine to use with asyncio.create_task (or a separate api for async usage, or something)
r

red-match-15116

12/22/2021, 7:38 PM
There's an open issue for this
But I think you could possibly do this by wrapping the calls in a coroutine yourself
b

breezy-table-35227

12/22/2021, 7:40 PM
wouldn’t they block the entire event loop?
(ty for the issue link btw)
r

red-match-15116

12/22/2021, 7:43 PM
yeah possibly, tbh never tried this myself i dunno if what i'm suggesting is realistic
b

breezy-table-35227

12/22/2021, 7:44 PM
AIUI (i’ve got some asyncio experience, but i’m not an expert) there has to be something that’s Awaitable for it to avoid blocking the event loop
it may potentially be not-absurd to wrap it in multiprocessing first
oh neat, i see it’s ultimately just wrapping subprocess, that means it should be fairly straightforward to make an asyncio version …
r

red-match-15116

12/22/2021, 7:57 PM
Yeah just keep in mind this caveat: https://github.com/pulumi/pulumi/issues/6052 But as long as they're in different processes you're golden.