This message was deleted.
# general
s
This message was deleted.
e
Is this using automation api, or just trying to call the CLI from multiple go routines?
b
No I am running everuthing inside go code base, not using cli
e
So with automation api? It should work in parallel, I know of customers using the typescript and python apis for that, I'd think Go would work as well.
b
Copy code
func  provisionResource() error {
	var wg sync.WaitGroup
	responseChan := make(chan error, len(allSlackChannels))
	defer close(responseChan)

	for _, rsc := range listOfResource {
		wg.Add(1)
		go func(req type, ch chan error) {
			defer wg.Done()
			// pulumi go sdk logic to create resource
			}
			ch <- err
		}(slChannel, responseChan)
	}
	wg.Wait()
	for id := 0; id < len(listOfResource); id++ {
		err := <-responseChan
		if err != nil {
			return err
		}
	}
	
	return nil
}
This is kind of pseudo code. If I removed go routines and just run normal serial execution, it works fine.
e
What does "// pulumi go sdk logic to create resource" look like? Cause you don't have a pulumi context in that code shown
b
yeah actually inside the pulumi resource creation, I setup pulumi stack code, which uses pulumi context, then execute this code. https://www.pulumi.com/registry/packages/slack/
e
Ah right. So making multiple calls to pulumi.Run in parallel. That is not supported, you should have one pulumi.Run call per-process.
b
Ok, cool got it. I was also thinking so, like in my local setup I can see one file like this is automatically created, now whenever multiple go routine are fired in this block
backend.url
is getting changed everytime Thanks for the confirmation.