Remove colorful from ray core (#10723)

This commit is contained in:
Eric Liang
2020-09-10 18:41:59 -07:00
committed by Barak Michener
parent 72e19ede28
commit 70305267d2
5 changed files with 7 additions and 55 deletions
-29
View File
@@ -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("<bytes>"))
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=<bytes>, "
"object_store_memory=<bytes>).", worker_ram, object_ram)
spec = ResourceSpec(num_cpus, num_gpus, memory, object_store_memory,
resources, redis_max_memory)
assert spec.resolved()
+3 -14
View File
@@ -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:
+3
View File
@@ -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)
@@ -1,11 +1,4 @@
Local node IP: .+
Available RAM
Workers: .+ GiB
Objects: .+ GiB
To adjust these values, use
ray\.init\(memory=<bytes>, object_store_memory=<bytes>\)
Dashboard URL: .+
--------------------
Ray runtime started.
+1 -5
View File
@@ -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__":