From c1988697217bddbc3d3d78034b3aa18fffc4e82f Mon Sep 17 00:00:00 2001 From: Yiran Wang Date: Tue, 15 Sep 2020 17:23:29 -0700 Subject: [PATCH] [Autoscaler] Change poll interval to 5 sec when checking VMs status (#10462) --- python/ray/autoscaler/commands.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python/ray/autoscaler/commands.py b/python/ray/autoscaler/commands.py index 3769d2aa9..df95c8145 100644 --- a/python/ray/autoscaler/commands.py +++ b/python/ray/autoscaler/commands.py @@ -47,6 +47,8 @@ redis_client = None RUN_ENV_TYPES = ["auto", "host", "docker"] +POLL_INTERVAL = 5 + def _redis(): global redis_client @@ -379,10 +381,11 @@ def teardown_cluster(config_file: str, yes: bool, workers_only: bool, cf.bold(len(A)), _tags=dict(interval="1s")) - time.sleep(1) # todo: interval should be a variable + time.sleep( + POLL_INTERVAL) # todo: interval should be a variable A = remaining_nodes() - cli_logger.print("{} nodes remaining after 1 second.", - cf.bold(len(A))) + cli_logger.print("{} nodes remaining after {} second(s).", + cf.bold(len(A)), POLL_INTERVAL) cli_logger.success("No nodes remaining.") finally: provider.cleanup() @@ -427,7 +430,7 @@ def kill_node(config_file, yes, hard, override_cluster_name): _exec(updater, "ray stop", False, False) - time.sleep(5) + time.sleep(POLL_INTERVAL) if config.get("provider", {}).get("use_internal_ips", False) is True: node_ip = provider.internal_ip(node) @@ -594,7 +597,7 @@ def get_or_create_head_node(config, if len(nodes) == 1: head_node = nodes[0] break - time.sleep(1) + time.sleep(POLL_INTERVAL) cli_logger.newline() with cli_logger.group(