From 70305267d2a314197c19aca8bd7b52daf8341822 Mon Sep 17 00:00:00 2001 From: Eric Liang Date: Thu, 10 Sep 2020 18:41:59 -0700 Subject: [PATCH] Remove colorful from ray core (#10723) --- python/ray/resource_spec.py | 29 ------------------- python/ray/services.py | 17 ++--------- python/ray/tests/test_cli.py | 3 ++ .../test_cli_patterns/test_ray_start.txt | 7 ----- python/ray/tests/test_output.py | 6 +--- 5 files changed, 7 insertions(+), 55 deletions(-) diff --git a/python/ray/resource_spec.py b/python/ray/resource_spec.py index 392106c26..92845518f 100644 --- a/python/ray/resource_spec.py +++ b/python/ray/resource_spec.py @@ -10,9 +10,6 @@ import sys import ray import ray.ray_constants as ray_constants -from ray.autoscaler.cli_logger import cli_logger -import colorful as cf - logger = logging.getLogger(__name__) # Prefix for the node id resource that is automatically added to each node. @@ -223,32 +220,6 @@ class ResourceSpec( round(memory / 1e9, 2), int(100 * (memory / system_memory)))) - rounded_memory = ray_constants.round_to_memory_units( - memory, round_up=False) - worker_ram = round(rounded_memory / (1024**3), 2) - object_ram = round(object_store_memory / (1024**3), 2) - - # TODO(maximsmol): this behavior is strange since we do not have a - # good grasp on when this will get called - # (you have to study node.py to make a guess) - with cli_logger.group("Available RAM"): - cli_logger.labeled_value("Workers", "{} GiB", str(worker_ram)) - cli_logger.labeled_value("Objects", "{} GiB", str(object_ram)) - cli_logger.newline() - cli_logger.print("To adjust these values, use") - with cf.with_style("monokai") as c: - cli_logger.print( - " ray{0}init(memory{1}{2}, " - "object_store_memory{1}{2})", c.magenta("."), - c.magenta("="), c.purple("")) - - cli_logger.old_info( - logger, - "Starting Ray with {} GiB memory available for workers and up to " - "{} GiB for objects. You can adjust these settings " - "with ray.init(memory=, " - "object_store_memory=).", worker_ram, object_ram) - spec = ResourceSpec(num_cpus, num_gpus, memory, object_store_memory, resources, redis_max_memory) assert spec.resolved() diff --git a/python/ray/services.py b/python/ray/services.py index 1283925f8..ed937102a 100644 --- a/python/ray/services.py +++ b/python/ray/services.py @@ -13,13 +13,11 @@ import sys import time import colorama -import colorful as cf import psutil # Ray modules import ray import ray.ray_constants as ray_constants import redis -from ray.autoscaler.cli_logger import cli_logger resource = None if sys.platform != "win32": @@ -550,12 +548,6 @@ def wait_for_redis_to_start(redis_ip_address, redis_port, password=None): else: break else: - cli_logger.error( - "Unable to connect to Redis at " - "`{c.underlined}{}:{}{c.no_underlined}` after {} retries.", - redis_ip_address, redis_port, num_retries) - cli_logger.abort("Check your firewall and network settings.") - raise RuntimeError("Unable to connect to Redis. If the Redis instance " "is on a different machine, check that your " "firewall is configured properly.") @@ -1168,12 +1160,9 @@ def start_dashboard(require_dashboard, dashboard_url = ( f"{host if host != '0.0.0.0' else get_node_ip_address()}:{port}") - cli_logger.labeled_value("Dashboard URL", cf.underlined("http://{}"), - dashboard_url) - cli_logger.old_info(logger, "View the Ray dashboard at {}{}{}{}{}", - colorama.Style.BRIGHT, colorama.Fore.GREEN, - dashboard_url, colorama.Fore.RESET, - colorama.Style.NORMAL) + logger.info("View the Ray dashboard at {}{}http://{}{}{}".format( + colorama.Style.BRIGHT, colorama.Fore.GREEN, dashboard_url, + colorama.Fore.RESET, colorama.Style.NORMAL)) return dashboard_url, process_info else: diff --git a/python/ray/tests/test_cli.py b/python/ray/tests/test_cli.py index 7eee46011..dc20fc714 100644 --- a/python/ray/tests/test_cli.py +++ b/python/ray/tests/test_cli.py @@ -132,6 +132,9 @@ def _load_output_pattern(name): def _check_output_via_pattern(name, result): expected_lines = _load_output_pattern(name) + print("---") + print(result.output) + print("---") if result.exception is not None: print(result.output) diff --git a/python/ray/tests/test_cli_patterns/test_ray_start.txt b/python/ray/tests/test_cli_patterns/test_ray_start.txt index f9beae123..89a11306b 100644 --- a/python/ray/tests/test_cli_patterns/test_ray_start.txt +++ b/python/ray/tests/test_cli_patterns/test_ray_start.txt @@ -1,11 +1,4 @@ Local node IP: .+ -Available RAM - Workers: .+ GiB - Objects: .+ GiB - - To adjust these values, use - ray\.init\(memory=, object_store_memory=\) -Dashboard URL: .+ -------------------- Ray runtime started. diff --git a/python/ray/tests/test_output.py b/python/ray/tests/test_output.py index 347fc1686..61ef4a067 100644 --- a/python/ray/tests/test_output.py +++ b/python/ray/tests/test_output.py @@ -1,4 +1,3 @@ -import re import subprocess import sys import pytest @@ -40,10 +39,7 @@ def test_output(): lines = outputs.split("\n") for line in lines: print(line) - assert len(lines) == 8, lines - assert re.match(r".*Workers: .*GiB", lines[1]) - assert re.match(r".*Objects: .*GiB", lines[2]) - assert re.match(r".*Dashboard URL: http:.*", lines[6]) + assert len(lines) == 2, lines if __name__ == "__main__":