mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
This reverts commit f500292d41.
This commit is contained in:
+1
-10
@@ -38,7 +38,6 @@ aiogrpc.init_grpc_aio()
|
||||
class DashboardAgent(object):
|
||||
def __init__(self,
|
||||
redis_address,
|
||||
dashboard_agent_port,
|
||||
redis_password=None,
|
||||
temp_dir=None,
|
||||
log_dir=None,
|
||||
@@ -52,7 +51,6 @@ class DashboardAgent(object):
|
||||
self.redis_password = redis_password
|
||||
self.temp_dir = temp_dir
|
||||
self.log_dir = log_dir
|
||||
self.dashboard_agent_port = dashboard_agent_port
|
||||
self.metrics_export_port = metrics_export_port
|
||||
self.node_manager_port = node_manager_port
|
||||
self.object_store_name = object_store_name
|
||||
@@ -61,8 +59,7 @@ class DashboardAgent(object):
|
||||
assert self.node_id, "Empty node id (RAY_NODE_ID)."
|
||||
self.ip = ray._private.services.get_node_ip_address()
|
||||
self.server = aiogrpc.server(options=(("grpc.so_reuseport", 0), ))
|
||||
self.grpc_port = self.server.add_insecure_port(
|
||||
f"[::]:{self.dashboard_agent_port}")
|
||||
self.grpc_port = self.server.add_insecure_port("[::]:0")
|
||||
logger.info("Dashboard agent grpc address: %s:%s", self.ip,
|
||||
self.grpc_port)
|
||||
self.aioredis_client = None
|
||||
@@ -189,11 +186,6 @@ if __name__ == "__main__":
|
||||
required=True,
|
||||
type=int,
|
||||
help="The port to expose metrics through Prometheus.")
|
||||
parser.add_argument(
|
||||
"--dashboard-agent-port",
|
||||
required=True,
|
||||
type=int,
|
||||
help="The port on which the dashboard agent will receive GRPCs.")
|
||||
parser.add_argument(
|
||||
"--node-manager-port",
|
||||
required=True,
|
||||
@@ -296,7 +288,6 @@ if __name__ == "__main__":
|
||||
|
||||
agent = DashboardAgent(
|
||||
args.redis_address,
|
||||
args.dashboard_agent_port,
|
||||
redis_password=args.redis_password,
|
||||
temp_dir=temp_dir,
|
||||
log_dir=log_dir,
|
||||
|
||||
@@ -3,6 +3,7 @@ try:
|
||||
except ImportError:
|
||||
print("The dashboard requires aiohttp to run.")
|
||||
import sys
|
||||
|
||||
sys.exit(1)
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -111,13 +111,15 @@ class DataOrganizer:
|
||||
node_physical_stats = DataSource.node_physical_stats.get(node_id, {})
|
||||
node_stats = DataSource.node_stats.get(node_id, {})
|
||||
node = DataSource.nodes.get(node_id, {})
|
||||
node_ip = DataSource.node_id_to_ip.get(node_id)
|
||||
|
||||
# Merge node log count information into the payload
|
||||
log_info = DataSource.ip_and_pid_to_logs.get(node_ip, {})
|
||||
log_info = DataSource.ip_and_pid_to_logs.get(node_physical_stats["ip"],
|
||||
{})
|
||||
node_log_count = 0
|
||||
for entries in log_info.values():
|
||||
node_log_count += len(entries)
|
||||
error_info = DataSource.ip_and_pid_to_errors.get(node_ip, {})
|
||||
error_info = DataSource.ip_and_pid_to_errors.get(
|
||||
node_physical_stats["ip"], {})
|
||||
node_err_count = 0
|
||||
for entries in error_info.values():
|
||||
node_err_count += len(entries)
|
||||
|
||||
@@ -33,8 +33,9 @@ def test_actor_groups(ray_start_with_dashboard):
|
||||
foo_actors = [Foo.remote(4), Foo.remote(5)]
|
||||
infeasible_actor = InfeasibleActor.remote() # noqa
|
||||
results = [actor.do_task.remote() for actor in foo_actors] # noqa
|
||||
assert (wait_until_server_available(ray_start_with_dashboard["webui_url"])
|
||||
is True)
|
||||
webui_url = ray_start_with_dashboard["webui_url"]
|
||||
assert wait_until_server_available(webui_url)
|
||||
webui_url = format_web_url(webui_url)
|
||||
|
||||
timeout_seconds = 5
|
||||
@@ -74,66 +75,5 @@ def test_actor_groups(ray_start_with_dashboard):
|
||||
raise Exception(f"Timed out while testing, {ex_stack}")
|
||||
|
||||
|
||||
def test_kill_actor(ray_start_with_dashboard):
|
||||
@ray.remote
|
||||
class Actor:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def f(self):
|
||||
ray.show_in_dashboard("test")
|
||||
return os.getpid()
|
||||
|
||||
a = Actor.remote()
|
||||
worker_pid = ray.get(a.f.remote()) # noqa
|
||||
|
||||
webui_url = ray_start_with_dashboard["webui_url"]
|
||||
assert wait_until_server_available(webui_url)
|
||||
webui_url = format_web_url(webui_url)
|
||||
|
||||
def actor_killed(pid):
|
||||
"""Check For the existence of a unix pid."""
|
||||
try:
|
||||
os.kill(pid, 0)
|
||||
except OSError:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_actor():
|
||||
resp = requests.get(f"{webui_url}/logical/actor_groups")
|
||||
resp.raise_for_status()
|
||||
actor_groups_resp = resp.json()
|
||||
assert actor_groups_resp["result"] is True, actor_groups_resp["msg"]
|
||||
actor_groups = actor_groups_resp["data"]["actorGroups"]
|
||||
actor = actor_groups["Actor"]["entries"][0]
|
||||
return actor
|
||||
|
||||
def kill_actor_using_dashboard(actor):
|
||||
resp = requests.get(
|
||||
webui_url + "/logical/kill_actor",
|
||||
params={
|
||||
"actorId": actor["actorId"],
|
||||
"ipAddress": actor["ipAddress"],
|
||||
"port": actor["port"]
|
||||
})
|
||||
resp.raise_for_status()
|
||||
resp_json = resp.json()
|
||||
assert resp_json["result"] is True, "msg" in resp_json
|
||||
|
||||
start = time.time()
|
||||
last_exc = None
|
||||
while time.time() - start <= 10:
|
||||
try:
|
||||
actor = get_actor()
|
||||
kill_actor_using_dashboard(actor)
|
||||
last_exc = None
|
||||
break
|
||||
except (KeyError, AssertionError) as e:
|
||||
last_exc = e
|
||||
time.sleep(.1)
|
||||
assert last_exc is None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(pytest.main(["-v", __file__]))
|
||||
|
||||
@@ -94,15 +94,23 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
|
||||
return reporter_pb2.GetProfilingStatsReply(
|
||||
profiling_stats=profiling_stats, std_out=stdout, std_err=stderr)
|
||||
|
||||
async def ReportOCMetrics(self, request, context):
|
||||
# This function receives a GRPC containing OpenCensus (OC) metrics
|
||||
# from a Ray process, then exposes those metrics to Prometheus.
|
||||
async def ReportMetrics(self, request, context):
|
||||
# NOTE: Exceptions are not propagated properly
|
||||
# when we don't catch them here.
|
||||
try:
|
||||
self._metrics_agent.record_metric_points_from_protobuf(
|
||||
request.metrics)
|
||||
except Exception:
|
||||
metrcs_description_required = (
|
||||
self._metrics_agent.record_metrics_points(
|
||||
request.metrics_points))
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
logger.error(traceback.format_exc())
|
||||
return reporter_pb2.ReportOCMetricsReply()
|
||||
|
||||
# If metrics description is missing, we should notify cpp processes
|
||||
# that we need them. Cpp processes will then report them to here.
|
||||
# We need it when (1) a new metric is reported (application metric)
|
||||
# (2) a reporter goes down and restarted (currently not implemented).
|
||||
return reporter_pb2.ReportMetricsReply(
|
||||
metrcs_description_required=metrcs_description_required)
|
||||
|
||||
@staticmethod
|
||||
def _get_cpu_percent():
|
||||
@@ -117,7 +125,8 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
|
||||
try:
|
||||
gpus = gpustat.new_query().gpus
|
||||
except Exception as e:
|
||||
logger.debug(f"gpustat failed to retrieve GPU information: {e}")
|
||||
logger.debug(
|
||||
"gpustat failed to retrieve GPU information: {}".format(e))
|
||||
for gpu in gpus:
|
||||
# Note the keys in this dict have periods which throws
|
||||
# off javascript so we change .s to _s
|
||||
@@ -224,8 +233,12 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
|
||||
"cmdline": self._get_raylet_cmdline(),
|
||||
}
|
||||
|
||||
async def _perform_iteration(self, aioredis_client):
|
||||
async def _perform_iteration(self):
|
||||
"""Get any changes to the log files and push updates to Redis."""
|
||||
aioredis_client = await aioredis.create_redis_pool(
|
||||
address=self._dashboard_agent.redis_address,
|
||||
password=self._dashboard_agent.redis_password)
|
||||
|
||||
while True:
|
||||
try:
|
||||
stats = self._get_all_stats()
|
||||
@@ -236,8 +249,5 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
|
||||
reporter_consts.REPORTER_UPDATE_INTERVAL_MS / 1000)
|
||||
|
||||
async def run(self, server):
|
||||
aioredis_client = await aioredis.create_redis_pool(
|
||||
address=self._dashboard_agent.redis_address,
|
||||
password=self._dashboard_agent.redis_password)
|
||||
reporter_pb2_grpc.add_ReporterServiceServicer_to_server(self, server)
|
||||
await self._perform_iteration(aioredis_client)
|
||||
await self._perform_iteration()
|
||||
|
||||
@@ -130,7 +130,7 @@ class TuneController(dashboard_utils.DashboardHeadModule):
|
||||
|
||||
# search through all the sub_directories in log directory
|
||||
analysis = Analysis(str(self._logdir))
|
||||
df = analysis.dataframe(metric=None, mode=None)
|
||||
df = analysis.dataframe(metric="episode_reward_mean", mode="max")
|
||||
|
||||
if len(df) == 0 or "trial_id" not in df.columns:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user