Skip to content

Commit 6d5f2ae

Browse files
add sessions on hold to /getAISessionPoolsInfo data
1 parent 73f69fb commit 6d5f2ae

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

server/handlers.go

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ type poolOrchestrator struct {
305305

306306
// aiPoolInfo contains information about an AI pool.
307307
type aiPoolInfo struct {
308-
Size int `json:"size"`
309-
InUse int `json:"in_use"`
310-
Orchestrators []poolOrchestrator `json:"orchestrators"`
308+
Size int `json:"size"`
309+
InUse int `json:"in_use"`
310+
Orchestrators []poolOrchestrator `json:"orchestrators"`
311+
OnHold map[string][]poolOrchestrator `json:"on_hold"`
311312
}
312313

313314
// suspendedInfo contains information about suspended orchestrators.
@@ -342,8 +343,9 @@ func (s *LivepeerServer) getAIPoolsInfoHandler() http.Handler {
342343
// Loop through selectors and get pools info.
343344
for cap, pool := range s.AISessionManager.selectors {
344345
warmPool := aiPoolInfo{
345-
Size: pool.warmPool.Size(),
346-
InUse: len(pool.warmPool.inUseSess),
346+
Size: pool.warmPool.Size(),
347+
InUse: len(pool.warmPool.inUseSess),
348+
OnHold: make(map[string][]poolOrchestrator),
347349
}
348350
for _, sess := range pool.warmPool.sessMap {
349351
poolOrchestrator := poolOrchestrator{
@@ -353,6 +355,16 @@ func (s *LivepeerServer) getAIPoolsInfoHandler() http.Handler {
353355
}
354356
warmPool.Orchestrators = append(warmPool.Orchestrators, poolOrchestrator)
355357
}
358+
for id, sessions := range pool.warmPool.sessionsOnHold {
359+
for _, sess := range sessions {
360+
poolOrchestrator := poolOrchestrator{
361+
Url: sess.Transcoder(),
362+
LatencyScore: sess.LatencyScore,
363+
InFlight: len(sess.SegsInFlight),
364+
}
365+
warmPool.OnHold[id] = append(warmPool.OnHold[id], poolOrchestrator)
366+
}
367+
}
356368

357369
coldPool := aiPoolInfo{
358370
Size: pool.coldPool.Size(),
@@ -365,7 +377,16 @@ func (s *LivepeerServer) getAIPoolsInfoHandler() http.Handler {
365377
InFlight: len(sess.SegsInFlight),
366378
})
367379
}
368-
380+
for id, sessions := range pool.coldPool.sessionsOnHold {
381+
for _, sess := range sessions {
382+
poolOrchestrator := poolOrchestrator{
383+
Url: sess.Transcoder(),
384+
LatencyScore: sess.LatencyScore,
385+
InFlight: len(sess.SegsInFlight),
386+
}
387+
coldPool.OnHold[id] = append(coldPool.OnHold[id], poolOrchestrator)
388+
}
389+
}
369390
aiPoolsInfoResp[cap] = aiOrchestratorPools{
370391
Cold: coldPool,
371392
Warm: warmPool,

0 commit comments

Comments
 (0)