fix scale /  avoid returning coroutines
@@ -93,12 +93,10 @@ class Cluster(object):
if n >= len(self.scheduler.workers):
self.scheduler.loop.add_callback(self.scale_up, n)
else:
- to_close = self.scheduler.retire_workers(
- remove=False,
- close_workers=True,
- n=len(self.scheduler.workers) - n
- )
+ to_close = self.scheduler.workers_to_close(
+ n=len(self.scheduler.workers) - n)
logger.debug("Closing workers: %s", to_close)
+ self.scheduler.loop.add_callback(self.scheduler.retire_workers, workers=to_close)
self.scheduler.loop.add_callback(self.scale_down, to_close)
def _widget_status(self):
