From f35339b5ff3d5e85c20720637e28bd5a380a545e Mon Sep 17 00:00:00 2001 From: SangBin Cho Date: Thu, 27 Aug 2020 14:43:10 -0700 Subject: [PATCH] [Dashboard] Change default ip address for the dashboard to ipv4 (#10287) * Done. * Add todo. * Addressed code review. * Fix issue. * Fix test failure. * Fix a test. --- python/ray/parameter.py | 2 +- python/ray/ray_constants.py | 1 + python/ray/tests/test_metrics.py | 10 +++++----- python/ray/tests/test_output.py | 2 +- python/ray/worker.py | 2 +- python/setup.py | 3 +++ 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/python/ray/parameter.py b/python/ray/parameter.py index c872a32e4..9e7d38346 100644 --- a/python/ray/parameter.py +++ b/python/ray/parameter.py @@ -129,7 +129,7 @@ class RayParams: worker_path=None, huge_pages=False, include_dashboard=None, - dashboard_host="localhost", + dashboard_host=ray_constants.DEFAULT_DASHBOARD_IP, dashboard_port=ray_constants.DEFAULT_DASHBOARD_PORT, logging_level=logging.INFO, logging_format=ray_constants.LOGGER_FORMAT, diff --git a/python/ray/ray_constants.py b/python/ray/ray_constants.py index e6d67d8dc..47aff0ebe 100644 --- a/python/ray/ray_constants.py +++ b/python/ray/ray_constants.py @@ -36,6 +36,7 @@ REDIS_MINIMUM_MEMORY_BYTES = 10**7 # we attempt to start the service running at this port. DEFAULT_PORT = 6379 +DEFAULT_DASHBOARD_IP = "127.0.0.1" DEFAULT_DASHBOARD_PORT = 8265 PROMETHEUS_SERVICE_DISCOVERY_FILE = "prom_metrics_service_discovery.json" # Default resource requirements for actors when no resource requirements are diff --git a/python/ray/tests/test_metrics.py b/python/ray/tests/test_metrics.py index 79c52b017..6bdaa334f 100644 --- a/python/ray/tests/test_metrics.py +++ b/python/ray/tests/test_metrics.py @@ -132,7 +132,7 @@ def test_worker_stats(shutdown_only): assert (wait_until_server_available(addresses["webui_url"]) is True) webui_url = addresses["webui_url"] - webui_url = webui_url.replace("localhost", "http://127.0.0.1") + webui_url = webui_url.replace("127.0.0.1", "http://127.0.0.1") for worker in reply.workers_stats: if worker.is_driver: continue @@ -198,7 +198,7 @@ def test_raylet_info_endpoint(shutdown_only): time.sleep(1) try: webui_url = addresses["webui_url"] - webui_url = webui_url.replace("localhost", "http://127.0.0.1") + webui_url = webui_url.replace("127.0.0.1", "http://127.0.0.1") response = requests.get(webui_url + "/api/raylet_info") response.raise_for_status() try: @@ -276,7 +276,7 @@ def test_raylet_infeasible_tasks(shutdown_only): def test_infeasible_actor(ray_addresses): assert (wait_until_server_available(addresses["webui_url"]) is True) - webui_url = ray_addresses["webui_url"].replace("localhost", + webui_url = ray_addresses["webui_url"].replace("127.0.0.1", "http://127.0.0.1") raylet_info = requests.get(webui_url + "/api/raylet_info").json() actor_info = raylet_info["result"]["actors"] @@ -316,7 +316,7 @@ def test_raylet_pending_tasks(shutdown_only): def test_pending_actor(ray_addresses): assert (wait_until_server_available(addresses["webui_url"]) is True) - webui_url = ray_addresses["webui_url"].replace("localhost", + webui_url = ray_addresses["webui_url"].replace("127.0.0.1", "http://127.0.0.1") raylet_info = requests.get(webui_url + "/api/raylet_info").json() actor_info = raylet_info["result"]["actors"] @@ -409,7 +409,7 @@ def test_memory_dashboard(shutdown_only): https://docs.ray.io/en/latest/memory-management.html#debugging-using-ray-memory """ addresses = ray.init(num_cpus=2) - webui_url = addresses["webui_url"].replace("localhost", "http://127.0.0.1") + webui_url = addresses["webui_url"].replace("127.0.0.1", "http://127.0.0.1") assert (wait_until_server_available(addresses["webui_url"]) is True) def get_memory_table(): diff --git a/python/ray/tests/test_output.py b/python/ray/tests/test_output.py index edc25ae41..da3b479d3 100644 --- a/python/ray/tests/test_output.py +++ b/python/ray/tests/test_output.py @@ -48,7 +48,7 @@ def test_output(): r"for objects. You can adjust these settings with .*?.", lines[0]) assert re.match( logging_header + - r"services.py:\d+ -- View the Ray dashboard at .*?localhost:\d+?.*", + r"services.py:\d+ -- View the Ray dashboard at .*?127.0.0.1:\d+?.*", lines[1]) diff --git a/python/ray/worker.py b/python/ray/worker.py index f70f1b612..72f72e1d0 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -501,7 +501,7 @@ def init(address=None, huge_pages=False, include_java=False, include_dashboard=None, - dashboard_host="localhost", + dashboard_host=ray_constants.DEFAULT_DASHBOARD_IP, dashboard_port=ray_constants.DEFAULT_DASHBOARD_PORT, job_id=None, job_config=None, diff --git a/python/setup.py b/python/setup.py index d2a7c2872..bbe2a0be4 100644 --- a/python/setup.py +++ b/python/setup.py @@ -132,6 +132,9 @@ extras["all"] = list(set(chain.from_iterable(extras.values()))) # should be carefully curated. If you change it, please reflect # the change in the matching section of requirements.txt install_requires = [ + # TODO(alex) Pin the version once this PR is + # included in the stable release. + # https://github.com/aio-libs/aiohttp/pull/4556#issuecomment-679228562 "aiohttp", "aiohttp_cors", "aioredis",