https://pulumi.com logo
Title
q

quaint-salesclerk-22166

12/13/2022, 1:30 PM
Is it possible to set Pulumi to perform async stack updates? I am creating Azure Managed Instances, which takes more than 4 hours. I would like to just run
res, err = globalStack.Up(globalCtx, stdoutStreamer)
and let Pulumi service run independently. Now it runs for a while but then it fails since the golang cli from where I am running stack updates is no longer running.
m

many-telephone-49025

12/13/2022, 2:43 PM
Interesting question. You can the option of remote deployment https://github.com/pulumi/automation-api-examples/tree/main/go/remote_deployment to use the new Pulumi Deployment feature!
Default Timeout on Pulumi Deployment is 2h but I can ask engineering if there is an option to extend this.
Or you need to come up with your own implementation, like a container, function etc to execute the cli only for the long running deployments
Could see the Pulumi k8s-operator doing this 🙂
q

quaint-salesclerk-22166

12/13/2022, 2:46 PM
In my case, the activity fails after 5 mins but the instance is created after 5 hours without any problem. The thing is that I am sending to Pulumi 2 resources to be created (the instance and the database) but only the instance is created
m

many-telephone-49025

12/13/2022, 2:47 PM
q

quaint-salesclerk-22166

12/13/2022, 2:48 PM
Not related i think
Diagnostics:
  pulumi:pulumi:Stack (jandroav/jarvis/jandro)
    warning: Attempting to deploy or update resources with 4 pending operations from previous deployment.
  * urn:pulumi:jandro::jarvis::azure-native:sql:ManagedInstance::jarvis-mssql-teams-app, interrupted while creating
  * urn:pulumi:jandro::jarvis::azure-native:sql:ManagedInstance::jarvis-mssql-teams-app, interrupted while creating
  * urn:pulumi:jandro::jarvis::azure-native:sql:ManagedInstance::jarvis-mssql-teams-app, interrupted while creating
  * urn:pulumi:jandro::jarvis::azure-native:sql:ManagedInstance::jarvis-mssql-teams-app, interrupted while creating
These resources are in an unknown state because the Pulumi CLI was interrupted while waiting for changes to these resources to complete. You should confirm whether or not the operations listed completed successfully by checking the state of the appropriate provider. For example, if you are using AWS, you can confirm using the AWS Console.

Once you have confirmed the status of the interrupted operations, you can repair your stack using `pulumi refresh` which will refresh the state from the provider you are using and clear the pending operations if there are any.

Note that `pulumi refresh` will need to be run interactively to clear pending CREATE operations.
I think that is because my golang cli is no longer running
My pulumi function consists on 2 resource creation, and the second depends on the first one
m

many-telephone-49025

12/13/2022, 2:52 PM
and why the cli stops Should it not wait
q

quaint-salesclerk-22166

12/13/2022, 2:53 PM
cause it will be waiting for 5 hours and no other cli command could be executed
m

many-telephone-49025

12/13/2022, 2:55 PM
yes, and that could be the issue with the state file being in an unknown state
q

quaint-salesclerk-22166

12/13/2022, 2:55 PM
the cli executes something like
jarvis db create
and then you need to be able to run other stuff. thats why i thought it could be nice to let the pulumi service handle it in a async way
the cli ends cause I am executing the pulumi function in a goroutine
go func() {
		_, err := executePulumiFunction(cm.AZURE, deployManagedInstanceFunc, destroy)
		if err != nil {
			log.Error(err)
		}
	}()
that's the only way I found to call pulumi without waiting 5 hours for the Azure Managed instance, but the thing I am missing is the ability of Pulumi to not fail after 5 min 🙂. My idea is to provide the user with the database connection details and a message like : "DB creation in progress, try to connect in 5 hours xD"
do you think remote deployment could help me here?
m

many-telephone-49025

12/13/2022, 3:01 PM
let me ask @echoing-dinner-19531 or @limited-rainbow-51650 if they have an idea without any major architectural changes in your cli
q

quaint-salesclerk-22166

12/13/2022, 3:01 PM
thanks a lot!
e

echoing-dinner-19531

12/13/2022, 3:17 PM
the cli ends cause I am executing the pulumi function in a goroutine
You should be able to keep the CLI alive with waitgroups: https://gobyexample.com/waitgroups But it does sounds like the deployment API is more what you want here, that will let our server carry on running the program and waiting for the resources to be created.
m

many-telephone-49025

12/13/2022, 3:19 PM
q

quaint-salesclerk-22166

12/13/2022, 3:31 PM
hey team thanks a lot. I will check it right now
m

many-telephone-49025

12/13/2022, 3:33 PM
I try to reconstruct your inital use case @quaint-salesclerk-22166
Hi @quaint-salesclerk-22166, the Remote Deployment will only work with, as @echoing-dinner-19531 correctly pointed out, with the usage of
var wg sync.WaitGroup
But then your CLI will wait again for completion.
q

quaint-salesclerk-22166

12/14/2022, 7:07 AM
ok got it, no way to do without waiting