File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ def scale_layers(self, **kwargs):
267267 diff = requested - len (nodes )
268268 if diff == 0 :
269269 continue
270+ new_nodes = False
270271 while diff < 0 :
271272 node = nodes .pop (0 )
272273 funcs .append (node .terminate )
@@ -276,6 +277,7 @@ def scale_layers(self, **kwargs):
276277 nodes .append (node )
277278 funcs .append (node .launch )
278279 diff = requested - len (nodes )
280+ new_nodes = True
279281 # http://docs.celeryproject.org/en/latest/userguide/canvas.html#groups
280282 job = [func () for func in funcs ]
281283 # balance containers
@@ -285,8 +287,8 @@ def scale_layers(self, **kwargs):
285287 group (* job ).apply_async ().join ()
286288 # once nodes are in place, recalculate the formation and update the data bag
287289 databag = self .calculate ()
288- # force-converge nodes if there were changes
289- if job or containers_balanced :
290+ # force-converge nodes if there were new nodes or container rebalancing
291+ if new_nodes or containers_balanced :
290292 self .converge (databag )
291293 # save the formation with updated layers
292294 self .save ()
You can’t perform that action at this time.
0 commit comments