https://pulumi.com logo
#general
Title
# general
c

cold-piano-21918

02/28/2019, 5:31 PM
Trying to use
ecs.get_cluster
in python. Is there a code sample that shows how to do this? Do I really have to create an async function just to get the value?
Also I tried putting it in a function and
await ecs.get_cluster(cluster_name="<name>")
, but when I try to call the function, i get `coroutine 'get' was never awaited. Seems like a chicken and an egg if I have to await async functions but can't only await from within a function?
w

white-balloon-205

02/28/2019, 5:36 PM
See this thread from yesterday: https://pulumi-community.slack.com/archives/C84L4E3N1/p1551307179439800?thread_ts=1551307022.439300&amp;cid=C84L4E3N1 We're working on getting more documentation on this. As you can see in the example there - you don't have to await the async function, you just pass the result of the function into a resource input somewhere where you want to use it. We're definitely thinking about ways to improve this API design.
c

cold-piano-21918

02/28/2019, 5:58 PM
Thanks for the quick reply, this is the code I'm trying
Copy code
async def p():
    return await ecs.get_cluster(cluster_name="testcluster")

cluster_details = p()
But I get this error:
RuntimeWarning: coroutine 'p' was never awaited