Use math.MaxInt32 to signal unbounded parallelism
Downlevel versions of the Pulumi Node SDK assumed that a parallelism
level of zero implied serial execution, which current CLIs use to signal
unbounded parallelism. This commit works around the downlevel issue by
using math.MaxInt32 to signal unbounded parallelism.
(cherry picked from commit ca540cc736
)
This commit is contained in:
parent
b0a6766d96
commit
072a079833
5 changed files with 8 additions and 6 deletions
|
@ -133,7 +133,7 @@ func newDestroyCmd() *cobra.Command {
|
||||||
"Display operation as a rich diff showing the overall change")
|
"Display operation as a rich diff showing the overall change")
|
||||||
cmd.PersistentFlags().IntVarP(
|
cmd.PersistentFlags().IntVarP(
|
||||||
¶llel, "parallel", "p", defaultParallel,
|
¶llel, "parallel", "p", defaultParallel,
|
||||||
"Allow P resource operations to run in parallel at once (1 for no parallelism, 0 for unbounded parallelism)")
|
"Allow P resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded.")
|
||||||
cmd.PersistentFlags().BoolVarP(
|
cmd.PersistentFlags().BoolVarP(
|
||||||
&refresh, "refresh", "r", false,
|
&refresh, "refresh", "r", false,
|
||||||
"Refresh the state of the stack's resources before this update")
|
"Refresh the state of the stack's resources before this update")
|
||||||
|
|
|
@ -131,7 +131,7 @@ func newPreviewCmd() *cobra.Command {
|
||||||
"Display operation as a rich diff showing the overall change")
|
"Display operation as a rich diff showing the overall change")
|
||||||
cmd.PersistentFlags().IntVarP(
|
cmd.PersistentFlags().IntVarP(
|
||||||
¶llel, "parallel", "p", defaultParallel,
|
¶llel, "parallel", "p", defaultParallel,
|
||||||
"Allow P resource operations to run in parallel at once (1 for no parallelism, 0 for unbounded parallelism)")
|
"Allow P resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded.")
|
||||||
cmd.PersistentFlags().BoolVar(
|
cmd.PersistentFlags().BoolVar(
|
||||||
&showConfig, "show-config", false,
|
&showConfig, "show-config", false,
|
||||||
"Show configuration keys and variables")
|
"Show configuration keys and variables")
|
||||||
|
|
|
@ -142,7 +142,7 @@ func newRefreshCmd() *cobra.Command {
|
||||||
"Display operation as a rich diff showing the overall change")
|
"Display operation as a rich diff showing the overall change")
|
||||||
cmd.PersistentFlags().IntVarP(
|
cmd.PersistentFlags().IntVarP(
|
||||||
¶llel, "parallel", "p", defaultParallel,
|
¶llel, "parallel", "p", defaultParallel,
|
||||||
"Allow P resource operations to run in parallel at once (1 for no parallelism, 0 for unbounded parallelism)")
|
"Allow P resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded.")
|
||||||
cmd.PersistentFlags().BoolVar(
|
cmd.PersistentFlags().BoolVar(
|
||||||
&showReplacementSteps, "show-replacement-steps", false,
|
&showReplacementSteps, "show-replacement-steps", false,
|
||||||
"Show detailed resource replacement creates and deletes instead of a single step")
|
"Show detailed resource replacement creates and deletes instead of a single step")
|
||||||
|
|
|
@ -17,6 +17,7 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/pulumi/pulumi/pkg/tokens"
|
"github.com/pulumi/pulumi/pkg/tokens"
|
||||||
|
@ -36,7 +37,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultParallel = 0
|
defaultParallel = math.MaxInt32
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint: vetshadow, intentionally disabling here for cleaner err declaration/assignment.
|
// nolint: vetshadow, intentionally disabling here for cleaner err declaration/assignment.
|
||||||
|
@ -328,7 +329,7 @@ func newUpCmd() *cobra.Command {
|
||||||
"Display operation as a rich diff showing the overall change")
|
"Display operation as a rich diff showing the overall change")
|
||||||
cmd.PersistentFlags().IntVarP(
|
cmd.PersistentFlags().IntVarP(
|
||||||
¶llel, "parallel", "p", defaultParallel,
|
¶llel, "parallel", "p", defaultParallel,
|
||||||
"Allow P resource operations to run in parallel at once (1 for no parallelism, 0 for unbounded parallelism)")
|
"Allow P resource operations to run in parallel at once (1 for no parallelism). Defaults to unbounded.")
|
||||||
cmd.PersistentFlags().BoolVarP(
|
cmd.PersistentFlags().BoolVarP(
|
||||||
&refresh, "refresh", "r", false,
|
&refresh, "refresh", "r", false,
|
||||||
"Refresh the state of the stack's resources before this update")
|
"Refresh the state of the stack's resources before this update")
|
||||||
|
|
|
@ -16,6 +16,7 @@ package deploy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"math"
|
||||||
|
|
||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -50,7 +51,7 @@ func (o Options) DegreeOfParallelism() int {
|
||||||
|
|
||||||
// InfiniteParallelism returns whether or not the requested level of parallelism is unbounded.
|
// InfiniteParallelism returns whether or not the requested level of parallelism is unbounded.
|
||||||
func (o Options) InfiniteParallelism() bool {
|
func (o Options) InfiniteParallelism() bool {
|
||||||
return o.Parallel == 0
|
return o.Parallel == math.MaxInt32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Events is an interface that can be used to hook interesting engine/planning events.
|
// Events is an interface that can be used to hook interesting engine/planning events.
|
||||||
|
|
Loading…
Reference in a new issue