[autoscaler] Lint code that we forgot to lint in #4537 (#4584)

* Lint code that we forgot to lint in previous PR

* Revert setup command merge

* Lint

* Revert "Revert setup command merge"

This reverts commit 55e1cdb1f256ea51ef66a38730d8f7865f1f5ad1.

* Fix testReportsConfigFailures test

* Minor syntax tweaks

* Lint
This commit is contained in:
Kristian Hartikainen
2019-04-10 02:01:36 -07:00
committed by Yuhong Guo
parent 74fd3d7e21
commit ed02bf11f7
4 changed files with 17 additions and 15 deletions
+7 -8
View File
@@ -582,7 +582,7 @@ class StandardAutoscaler(object):
if successful_updated and self.config.get("restart_only", False):
init_commands = self.config["worker_start_ray_commands"]
elif successful_updated and self.config.get("no_restart", False):
init_commands = (self.config["worker_setup_commands"])
init_commands = self.config["worker_setup_commands"]
else:
init_commands = (self.config["worker_setup_commands"] +
self.config["worker_start_ray_commands"])
@@ -623,9 +623,8 @@ class StandardAutoscaler(object):
self.launch_queue.put((config, count))
def workers(self):
return self.provider.non_terminated_nodes(tag_filters={
TAG_RAY_NODE_TYPE: "worker"
})
return self.provider.non_terminated_nodes(
tag_filters={TAG_RAY_NODE_TYPE: "worker"})
def log_info_string(self, nodes):
logger.info("StandardAutoscaler: {}".format(self.info_string(nodes)))
@@ -713,10 +712,10 @@ def fillout_defaults(config):
def merge_setup_commands(config):
config["head_setup_commands"] = config["setup_commands"] + \
config["head_setup_commands"]
config["worker_setup_commands"] = config["setup_commands"] + \
config["worker_setup_commands"]
config["head_setup_commands"] = (
config["setup_commands"] + config["head_setup_commands"])
config["worker_setup_commands"] = (
config["setup_commands"] + config["worker_setup_commands"])
return config
+1 -1
View File
@@ -226,7 +226,7 @@ def get_or_create_head_node(config, config_file, no_restart, restart_only, yes,
if restart_only:
init_commands = config["head_start_ray_commands"]
elif no_restart:
init_commands = (config["head_setup_commands"])
init_commands = config["head_setup_commands"]
else:
init_commands = (config["head_setup_commands"] +
config["head_start_ray_commands"])
+4 -5
View File
@@ -45,15 +45,14 @@ def dockerize_if_needed(config):
docker_mounts, cname,
run_options + worker_run_options)
config["head_setup_commands"] = head_docker_start + \
with_docker_exec(config["head_setup_commands"],
container_name=cname)
config["head_setup_commands"] = head_docker_start + (with_docker_exec(
config["head_setup_commands"], container_name=cname))
config["head_start_ray_commands"] = (
docker_autoscaler_setup(cname) + with_docker_exec(
config["head_start_ray_commands"], container_name=cname))
config["worker_setup_commands"] = worker_docker_start + \
with_docker_exec(config["worker_setup_commands"], container_name=cname)
config["worker_setup_commands"] = worker_docker_start + (with_docker_exec(
config["worker_setup_commands"], container_name=cname))
config["worker_start_ray_commands"] = with_docker_exec(
config["worker_start_ray_commands"],
container_name=cname,
+5 -1
View File
@@ -538,7 +538,11 @@ class AutoscalingTest(unittest.TestCase):
self.waitForNodes(2, tag_filters={TAG_RAY_NODE_STATUS: "up-to-date"})
def testReportsConfigFailures(self):
config_path = self.write_config(SMALL_CLUSTER)
config = copy.deepcopy(SMALL_CLUSTER)
config['provider']['type'] = 'external'
config = fillout_defaults(config)
config['provider']['type'] = 'mock'
config_path = self.write_config(config)
self.provider = MockProvider()
runner = MockProcessRunner(fail_cmds=["cmd1"])
autoscaler = StandardAutoscaler(