Open t0yv0 opened 2 years ago
Should be quite easy to achieve, if we decide to expose this kind of API.
Adding an overload to the DefaultRunner
and an overloaded run
and runAsync
should do it from top of my head.
Internally, changing this:
public <T> CompletableFuture<Result<T>> runAsync(Supplier<T> callback) {
var valueFuture = CompletableFuture.supplyAsync(callback);
...
into:
public <T> CompletableFuture<Result<T>> runAsync(CompletableFuture<Supplier<T>> callback) {
...
in the DefaultRunner
would allow for this API to be added.
Hello!
Issue details
Current signature
Pulumi.run
assumes that the program will immediately register the stack outputs:What if the program does not know what the set of stack outputs is going to be until some CompletableFuture? The awkward workaround right now is to force (join) the Future inside the Pulumi program:
It would be nice to allow deferring that without blocking a thread. Perhaps
Pulumi.run(Function<Context,CompletableFuture<Void>>)
overload to let the user program signal to the framework that it has some work to do.I believe underlying framework supports this just fine, but we do not expose this capability to the user at the moment.
Not sure how useful this is in practice, but logging for posterity.
Affected area/feature