@@ -478,14 +478,40 @@ func (s *ServerHandler) getDatasets(req *restful.Request, resp *restful.Response
478478}
479479
480480func (s * ServerHandler ) getServeApplications (req * restful.Request , resp * restful.Response ) {
481+ clusterName := req .Attribute (COOKIE_CLUSTER_NAME_KEY ).(string )
482+ clusterNamespace := req .Attribute (COOKIE_CLUSTER_NAMESPACE_KEY ).(string )
481483 sessionName := req .Attribute (COOKIE_SESSION_NAME_KEY ).(string )
484+
482485 if sessionName == "live" {
483486 s .redirectRequest (req , resp )
484487 return
485488 }
486489
487- // Return "not yet supported" for serve applications
488- resp .WriteErrorString (http .StatusNotImplemented , "Serve applications not yet supported" )
490+ // Dead (historical) cluster:
491+ // Collector has already periodically persisted the live Ray Dashboard
492+ // /api/serve/applications/ response into the meta directory under the
493+ // OssMetaFile_Applications key. Here we simply read that snapshot and
494+ // return it so that live and historical clusters share the same response
495+ // format.
496+ rayClusterNameID := fmt .Sprintf ("%s_%s" , clusterName , clusterNamespace )
497+ data := s .MetaKeyInfo (rayClusterNameID , utils .OssMetaFile_Applications )
498+
499+ // If no metadata has been persisted yet, return an empty applications
500+ // payload matching Ray's ServeDetails schema.
501+ if len (data ) == 0 {
502+ empty := map [string ]interface {}{
503+ "applications" : map [string ]interface {}{},
504+ }
505+ var err error
506+ data , err = json .Marshal (empty )
507+ if err != nil {
508+ logrus .Errorf ("Failed to marshal empty serve applications response: %v" , err )
509+ resp .WriteErrorString (http .StatusInternalServerError , err .Error ())
510+ return
511+ }
512+ }
513+
514+ resp .Write (data )
489515}
490516
491517func (s * ServerHandler ) getPlacementGroups (req * restful.Request , resp * restful.Response ) {
0 commit comments