From 47637f0ce83bd8fc0176642fbe7da5a8f6841b4f Mon Sep 17 00:00:00 2001 From: Bryce Huang Date: Mon, 1 Apr 2024 10:46:55 -0500 Subject: [PATCH] [Dashboard] add memray to requirements.txt (#44315) memray is used by the memory profiler but it's currently missing in ray requirements. We will see this error if we try to get the memory profiling from a running actor. Signed-off-by: bhuang --- dashboard/modules/reporter/profile_manager.py | 3 +++ dashboard/optional_deps.py | 1 + python/ray/tests/test_minimal_install.py | 1 + python/requirements.txt | 1 + python/setup.py | 1 + 5 files changed, 7 insertions(+) diff --git a/dashboard/modules/reporter/profile_manager.py b/dashboard/modules/reporter/profile_manager.py index bb750b1cc97d5..b6da47f13938f 100644 --- a/dashboard/modules/reporter/profile_manager.py +++ b/dashboard/modules/reporter/profile_manager.py @@ -353,6 +353,9 @@ async def detach_profiler( cmd.append("--verbose") cmd.append(str(pid)) + if await _can_passwordless_sudo(): + cmd = ["sudo", "-n"] + cmd + process = await asyncio.create_subprocess_exec( *cmd, stdout=subprocess.PIPE, diff --git a/dashboard/optional_deps.py b/dashboard/optional_deps.py index 1dfaaca4d6273..2e2a596223fda 100644 --- a/dashboard/optional_deps.py +++ b/dashboard/optional_deps.py @@ -8,6 +8,7 @@ import opencensus # noqa: F401 import prometheus_client # noqa: F401 +import memray # noqa: F401 import aiohttp # noqa: F401 import aiohttp.web # noqa: F401 diff --git a/python/ray/tests/test_minimal_install.py b/python/ray/tests/test_minimal_install.py index c83765d34efdb..547faae5a6a44 100644 --- a/python/ray/tests/test_minimal_install.py +++ b/python/ray/tests/test_minimal_install.py @@ -80,6 +80,7 @@ def test_module_import_with_various_non_minimal_deps(pydantic_version: str): "aiohttp_cors", "pydantic", "grpc", + "memray", ] for i in range(len(optional_modules)): for install_modules in itertools.combinations(optional_modules, i): diff --git a/python/requirements.txt b/python/requirements.txt index 59858f8f177f0..3c2c2c6ce01b5 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -58,3 +58,4 @@ pandas>=1.3 pydantic!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,<3 # Serve users can use pydantic<2 py-spy>=0.2.0 watchfiles +memray diff --git a/python/setup.py b/python/setup.py index 0ae613aaef7e9..cbf9b2189f864 100644 --- a/python/setup.py +++ b/python/setup.py @@ -250,6 +250,7 @@ def get_packages(self): "prometheus_client >= 0.7.1", "smart_open", "virtualenv >=20.0.24, !=20.21.1", # For pip runtime env. + "memray", ], "client": [ # The Ray client needs a specific range of gRPC to work: