Skip to content

Commit

Permalink
multiregion: all regions start in running if no max_parallel
Browse files Browse the repository at this point in the history
If `max_parallel` is not set, all regions should begin in a `running` state
rather than a `pending` state. Otherwise the first region is set to `running`
and then all the remaining regions once it enters `blocked. That behavior is
technically correct in that we have at most `max_parallel` regions running,
but definitely not what a user expects.
  • Loading branch information
tgross committed Jun 19, 2020
1 parent 8fc76f5 commit d7277e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scheduler/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func (a *allocReconciler) Compute() *reconcileResults {
// Detect if the deployment is paused
if a.deployment != nil {
a.deploymentPaused = a.deployment.Status == structs.DeploymentStatusPaused
//|| a.deployment.Status == structs.DeploymentStatusPending
a.deploymentFailed = a.deployment.Status == structs.DeploymentStatusFailed
}
if a.deployment == nil {
Expand Down Expand Up @@ -555,9 +554,12 @@ func (a *allocReconciler) computeGroup(group string, all allocSet) bool {
// A previous group may have made the deployment already
if a.deployment == nil {
a.deployment = structs.NewDeployment(a.job)
// only the first region of a multiregion job starts in the
// running state
if a.job.IsMultiregion() && a.job.Region != a.job.Multiregion.Regions[0].Name {
// in a multiregion job, if max_parallel is set, only the first
// region starts in the running state
if a.job.IsMultiregion() &&
a.job.Multiregion.Strategy != nil &&
a.job.Multiregion.Strategy.MaxParallel != 0 &&
a.job.Region != a.job.Multiregion.Regions[0].Name {
a.deployment.Status = structs.DeploymentStatusPending
a.deployment.StatusDescription = structs.DeploymentStatusDescriptionPendingForPeer
}
Expand Down

0 comments on commit d7277e5

Please sign in to comment.