Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automation API] Support parallel execution of nodejs inline programs #5449

Closed
EvanBoyle opened this issue Sep 23, 2020 · 5 comments · Fixed by #10568
Closed

[Automation API] Support parallel execution of nodejs inline programs #5449

EvanBoyle opened this issue Sep 23, 2020 · 5 comments · Fixed by #10568
Assignees
Labels
Milestone

Comments

@EvanBoyle
Copy link
Contributor

EvanBoyle commented Sep 23, 2020

The Pulumi nodejs runtime implementation uses quite a bit of global state: https://github.com/pulumi/pulumi/blob/master/sdk/nodejs/runtime/settings.ts#L188

We'll need to refactor all usage of global state out of the node SDK to allow Automation API to execute concurrent programs on different stacks that use the inline/hosted execution model.

One consequence of this is that multiple versions of pulumi can cause problems due to conflicting module level global state. Automation API users should pin to a single version of pulumi/pulumi via yarn resolutions: https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

@EvanBoyle
Copy link
Contributor Author

To be clear for nodejs users, the Automation API allows one concurrent update per node process for the time being. If you want to run multiple updates in parallel, they will need to be in separate node processes.

@georgeportillo
Copy link

georgeportillo commented Jun 10, 2022

pulumi/pulumi

pulumi/pulumi or @pulumi/pulumi ?

@Frassle
Copy link
Member

Frassle commented Aug 15, 2022

https://nodejs.org/api/async_context.html#new-asynclocalstorage could probably solve this now, similar to how we use AsyncLocal in dotnet.

@Moshemo
Copy link

Moshemo commented Sep 7, 2023

To be clear for nodejs users, the Automation API allows one concurrent update per node process for the time being. If you want to run multiple updates in parallel, they will need to be in separate node processes.

Does this still relevant ?
Am I able to run nodeJS app in parallel with out separate node processes today ?

@Frassle
Copy link
Member

Frassle commented Sep 7, 2023

It's not still relevant, automation API should correctly run updates in parallel now.

justinvp added a commit that referenced this issue Oct 10, 2023
This change removes the SxS check in the Node.js Automation API since it's blocking a customer scenario and isn't needed anymore now that #5449 has been addressed with #10568.

The check was originally added in #7349 to provide a helpful error message when multiple versions of `@pulumi/pulumi` were used with inline programs, which could cause clashes with global state. Since then, we've changed how state is stored to allow parallel execution of multiple inline programs with #10568. However, the SxS checks were not removed as part of that change.

A customer recently hit the error associated with the SxS check. They are creating a Next.js program that runs Pulumi operations as inline programs. Next.js ends up loading modules multiple times in a way that confuses the SxS checker, causing the error to be thrown, even though it wouldn't have been a problem.
justinvp added a commit that referenced this issue Oct 10, 2023
This change removes the SxS check in the Node.js Automation API since it's blocking a customer scenario and isn't needed anymore now that #5449 has been addressed with #10568.

The check was originally added in #7349 to provide a helpful error message when multiple versions of `@pulumi/pulumi` were used with inline programs, which could cause clashes with global state. Since then, we've changed how state is stored to allow parallel execution of multiple inline programs with #10568. However, the SxS checks were not removed as part of that change.

A customer recently hit the error associated with the SxS check. They are creating a Next.js program that runs Pulumi operations as inline programs. Next.js ends up loading modules multiple times in a way that confuses the SxS checker, causing the error to be thrown, even though it wouldn't have been a problem.
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2023
This change removes the SxS check in the Node.js Automation API since
it's blocking a customer scenario and isn't needed anymore now that
#5449 has been addressed with #10568.

The check was originally added in #7349 to provide a helpful error
message when multiple versions of `@pulumi/pulumi` were used with inline
programs, which could cause clashes with global state. Since then, we've
changed how state is stored to allow parallel execution of multiple
inline programs with #10568. However, the SxS checks were not removed as
part of that change.

A customer recently hit the error associated with the SxS check. They
are creating a Next.js program that runs Pulumi operations as inline
programs. Next.js ends up loading modules multiple times in a way that
confuses the SxS checker, causing the error to be thrown, even though it
wouldn't have been a problem.

Fixes #14128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
8 participants