@@ -95,12 +95,8 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
9595 jobIteration = service .JobStatus .JobIteration
9696 }
9797
98- maxRaw := service .Spec .Mode .ReplicatedJob .MaxConcurrent
99- totalRaw := service .Spec .Mode .ReplicatedJob .TotalCompletions
100-
101- max := int (* maxRaw )
102- total := int (* totalRaw )
103-
98+ maxConcurrent := int (* service .Spec .Mode .ReplicatedJob .MaxConcurrent )
99+ totalCompletions := int (* service .Spec .Mode .ReplicatedJob .TotalCompletions )
104100 previousResult := ""
105101
106102 return func (log poll.LogT ) poll.Result {
@@ -133,16 +129,16 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
133129 }
134130
135131 switch {
136- case running > max :
132+ case running > maxConcurrent :
137133 return poll .Error (fmt .Errorf (
138- "number of running tasks (%v) exceeds max (%v)" , running , max ,
134+ "number of running tasks (%v) exceeds max (%v)" , running , maxConcurrent ,
139135 ))
140- case (completed + running ) > total :
136+ case (completed + running ) > totalCompletions :
141137 return poll .Error (fmt .Errorf (
142138 "number of tasks exceeds total (%v), %v running and %v completed" ,
143- total , running , completed ,
139+ totalCompletions , running , completed ,
144140 ))
145- case completed == total && running == 0 :
141+ case completed == totalCompletions && running == 0 :
146142 return poll .Success ()
147143 default :
148144 newRes := fmt .Sprintf (
@@ -156,7 +152,7 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
156152
157153 return poll .Continue (
158154 "Job not yet finished, %v completed and %v running out of %v total" ,
159- completed , running , total ,
155+ completed , running , totalCompletions ,
160156 )
161157 }
162158 }
0 commit comments