[dashboard] Include ray session name in dashboard snapshot (#16199)

* .

* .

* .

Co-authored-by: Alex Wu <alex@anyscale.com>
This commit is contained in:
Alex Wu 2021-06-02 15:07:06 -07:00 committed by Dmitri Gekhtman
parent 86e24563a1
commit 4ed174d167
2 changed files with 13 additions and 1 deletions

View file

@ -14,14 +14,17 @@ class LogicalViewHead(dashboard_utils.DashboardHeadModule):
super().__init__(dashboard_head) super().__init__(dashboard_head)
self._gcs_job_info_stub = None self._gcs_job_info_stub = None
self._gcs_actor_info_stub = None self._gcs_actor_info_stub = None
self._dashboard_head = dashboard_head
@routes.get("/api/snapshot") @routes.get("/api/snapshot")
async def snapshot(self, req): async def snapshot(self, req):
job_data = await self.get_job_info() job_data = await self.get_job_info()
actor_data = await self.get_actor_info() actor_data = await self.get_actor_info()
session_name = await self.get_session_name()
snapshot = { snapshot = {
"jobs": job_data, "jobs": job_data,
"actors": actor_data, "actors": actor_data,
"session_name": session_name,
} }
return dashboard_utils.rest_response( return dashboard_utils.rest_response(
success=True, message="hello", snapshot=snapshot) success=True, message="hello", snapshot=snapshot)
@ -81,6 +84,11 @@ class LogicalViewHead(dashboard_utils.DashboardHeadModule):
actors[actor_id] = entry actors[actor_id] = entry
return actors return actors
async def get_session_name(self):
encoded_name = await self._dashboard_head.aioredis_client.get(
"session_name")
return encoded_name.decode()
async def run(self, server): async def run(self, server):
self._gcs_job_info_stub = gcs_service_pb2_grpc.JobInfoGcsServiceStub( self._gcs_job_info_stub = gcs_service_pb2_grpc.JobInfoGcsServiceStub(
self._dashboard_head.aiogrpc_gcs_channel) self._dashboard_head.aiogrpc_gcs_channel)

View file

@ -134,9 +134,13 @@
} }
} }
}, },
"sessionName": {
"type": "string"
},
"required": [ "required": [
"jobs", "jobs",
"actors" "actors",
"sessionName"
] ]
} }
}, },