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

thousands-notebook-91098

02/27/2019, 5:35 PM
I'm curious how that async stuff works under the hood in terms of generating a declarative state and then applying it. Since imperative languages are generally serially interpreted I wonder how often people will run into these issues moving forward
i

incalculable-sundown-82514

02/27/2019, 5:39 PM
It might be a bit esoteric but you can think of Pulumi as a “graph executor” - it receives a graph of your desired state, turns that graph into a set of concrete steps that need to be completed, and then executes them all in order, possibly in parallel. Since Pulumi lets you inspect the outputs of resources that are getting created as part of this graph execution, it’s naturally the case that the ouptuts of a resources resolve asynchronously, as resources get created and Pulumi advances the execution of the graph. The asynchrony mirrors data flow dependencies between resources, and really when you’re writing a Pulumi program what you’re doing is connecting together different asynchronous streams of data. It’s confusing when these things don’t happen synchronously, but doing things asynchronously lets us present a facade of an imperative object model on top of a declarative, asynchronous data model.
People do run into this often, and it’s unfortunate that this leaks into user programs the way that it does. We thought hard about this and weren’t able to come up with anything better that still had the properties that we wanted
t

thousands-notebook-91098

02/27/2019, 5:40 PM
thank you for the explanation, that was very well presented
you're just making me want to find more reasons to give pulumi a whirl at work
i

incalculable-sundown-82514

02/27/2019, 5:40 PM
yay! 😄
I think the only time you really only ever need to think about asynchrony with Pulumi programs is when you interact with data sources - I think we do a pretty OK job hiding it everywhere else.