@@ -25,6 +25,7 @@ type DataStatus struct {
2525 Code StatusCode `json:"status_code"`
2626}
2727
28+ // There is one APIStatus per API resource ID (including stale/removed models). There is always an APIStatus for APIs currently in the context.
2829type APIStatus struct {
2930 APISavedStatus
3031 Path string `json:"path"`
@@ -37,36 +38,51 @@ type APIStatus struct {
3738}
3839
3940type ReplicaCounts struct {
40- ReadyUpdated int32 `json:"ready_updated"`
41- ReadyStaleCompute int32 `json:"ready_stale_compute"`
42- ReadyStaleResource int32 `json:"ready_stale_resource"`
43- FailedUpdated int32 `json:"failed_updated"`
44- FailedStaleCompute int32 `json:"failed_stale_compute"`
45- FailedStaleResource int32 `json:"failed_stale_resource"`
41+ ReadyUpdatedCompute int32 `json:"ready_updated_compute"`
42+ ReadyStaleCompute int32 `json:"ready_stale_compute"`
43+ FailedUpdatedCompute int32 `json:"failed_updated_compute"`
44+ FailedStaleCompute int32 `json:"failed_stale_compute"`
45+ K8sRequested int32 `json:"k8s_requested"` // Number of requested replicas in an active k8s.deployment for this resource ID
4646}
4747
48+ // There is one APIGroupStatus per API name/endpoint
4849type APIGroupStatus struct {
49- APIName string `json:"api_name"`
50- Start * time.Time `json:"start"`
51- ActiveStatus * APIStatus `json:"active_status"`
52- Code StatusCode `json:"status_code"`
50+ APIName string `json:"api_name"`
51+ Start * time.Time `json:"start"`
52+ ActiveStatus * APIStatus `json:"active_status"` // The most recently ready API status, or the ctx API status if it's ready
53+ Code StatusCode `json:"status_code"`
54+ GroupedReplicaCounts `json:"grouped_replica_counts"`
55+ }
56+
57+ type GroupedReplicaCounts struct {
58+ ReadyUpdated int32 `json:"ready_updated"` // Updated means the replica is fully up-to-date (compute and model match the API's current resource ID in the context)
59+ ReadyStaleModel int32 `json:"ready_stale_model"` // Stale model means the replica is serving a model which not currently in the context (either it was updated or removed)
60+ ReadyStaleCompute int32 `json:"ready_stale_compute"` // Stale compute means the replica is serving the correct model, but the compute request has changed
61+ FailedUpdated int32 `json:"failed_updated"`
62+ FailedStaleModel int32 `json:"failed_stale_model"`
63+ FailedStaleCompute int32 `json:"failed_stale_compute"`
5364}
5465
5566type Status interface {
5667 Message () string
5768 GetCode () StatusCode
5869}
5970
60- func (replicaCounts * ReplicaCounts ) TotalReady () int32 {
61- return replicaCounts .ReadyUpdated + replicaCounts .ReadyStaleCompute + replicaCounts .ReadyStaleResource
71+ func (rc * ReplicaCounts ) TotalReady () int32 {
72+ return rc .ReadyUpdatedCompute + rc .ReadyStaleCompute
73+ }
74+
75+ func (rc * ReplicaCounts ) TotalFailed () int32 {
76+ return rc .FailedUpdatedCompute + rc .FailedStaleCompute
6277}
6378
64- func (replicaCounts * ReplicaCounts ) TotalStaleReady () int32 {
65- return replicaCounts . ReadyStaleCompute + replicaCounts . ReadyStaleResource
79+ func (grc * GroupedReplicaCounts ) Available () int32 {
80+ return grc . ReadyUpdated + grc . ReadyStaleModel + grc . ReadyStaleCompute
6681}
6782
68- func (replicaCounts * ReplicaCounts ) TotalStale () int32 {
69- return replicaCounts .ReadyStaleCompute + replicaCounts .ReadyStaleResource + replicaCounts .FailedStaleCompute + replicaCounts .FailedStaleResource
83+ // Number of replicas with the up-to-date model (includes stale compute)
84+ func (grc * GroupedReplicaCounts ) UpToDate () int32 {
85+ return grc .ReadyUpdated + grc .ReadyStaleCompute
7086}
7187
7288func (status * DataStatus ) GetCode () StatusCode {
@@ -91,26 +107,21 @@ const (
91107 StatusPendingCompute
92108 StatusWaiting // Resource can be created based on resource DAG, but hasn't started yet
93109 StatusSkipped
110+ StatusError
94111 StatusParentFailed
95112 StatusParentKilled
96113 StatusKilledOOM
97114
98115 // Data statuses
99116 StatusRunning
100117 StatusSucceeded
101- StatusFailed
102118 StatusKilled
103119
104120 // API statuses
105- StatusUpdating
106- StatusReady
121+ StatusCreating
122+ StatusLive
107123 StatusStopping
108124 StatusStopped
109- StatusError
110-
111- // Additional API group statuses (i.e. aggregated API status)
112- StatusPendingUpdate
113- StatusUpdateSkipped
114125)
115126
116127var statusCodes = []string {
@@ -120,26 +131,22 @@ var statusCodes = []string{
120131 "status_pending_compute" ,
121132 "status_waiting" ,
122133 "status_skipped" ,
134+ "status_error" ,
123135 "status_parent_failed" ,
124136 "status_parent_killed" ,
125137 "status_killed_oom" ,
126138
127139 "status_running" ,
128140 "status_succeeded" ,
129- "status_failed" ,
130141 "status_killed" ,
131142
132- "status_updating " ,
133- "status_ready " ,
143+ "status_creating " ,
144+ "status_live " ,
134145 "status_stopping" ,
135146 "status_stopped" ,
136- "status_error" ,
137-
138- "status_pending_update" ,
139- "status_update_skipped" ,
140147}
141148
142- var _ = [1 ]int {}[int (StatusUpdateSkipped )- (len (statusCodes )- 1 )] // Ensure list length matches
149+ var _ = [1 ]int {}[int (StatusStopped )- (len (statusCodes )- 1 )] // Ensure list length matches
143150
144151var statusCodeMessages = []string {
145152 "unknown" , // StatusUnknown
@@ -148,27 +155,22 @@ var statusCodeMessages = []string{
148155 "compute unavailable" , // StatusPendingCompute
149156 "pending" , // StatusWaiting
150157 "skipped" , // StatusSkipped
158+ "error" , // StatusError
151159 "upstream error" , // StatusParentFailed
152160 "upstream termination" , // StatusParentKilled
153161 "terminated (out of mem)" , // StatusDataOOM
154162
155- "running" , // StatusDataRunning
156- "ready" , // StatusDataSucceeded
157- "error" , // StatusDataFailed
158- "terminated" , // StatusDataKilled
159-
160- "updating" , // StatusAPIUpdating
161- "ready" , // StatusAPIReady
162- "stopping" , // StatusAPIStopping
163- "stopped" , // StatusAPIStopped
164- "error" , // StatusAPIError
165-
166- "update pending" , // StatusAPIGroupPendingUpdate
167- "update skipped" , // StatusAPIGroupUpdateSkipped
163+ "running" , // StatusRunning
164+ "ready" , // StatusSucceeded
165+ "terminated" , // StatusKilled
168166
167+ "creating" , // StatusCreating
168+ "live" , // StatusLive
169+ "stopping" , // StatusStopping
170+ "stopped" , // StatusStopped
169171}
170172
171- var _ = [1 ]int {}[int (StatusUpdateSkipped )- (len (statusCodeMessages )- 1 )] // Ensure list length matches
173+ var _ = [1 ]int {}[int (StatusStopped )- (len (statusCodeMessages )- 1 )] // Ensure list length matches
172174
173175// StatusDataRunning aliases
174176const (
@@ -186,26 +188,22 @@ var statusSortBuckets = []int{
186188 4 , // StatusPendingCompute
187189 4 , // StatusWaiting
188190 2 , // StatusSkipped
191+ 1 , // StatusError
189192 2 , // StatusParentFailed
190193 2 , // StatusParentKilled
191194 1 , // StatusKilledOOM
192195
193196 3 , // StatusRunning
194197 0 , // StatusSucceeded
195- 1 , // StatusFailed
196198 1 , // StatusKilled
197199
198- 3 , // StatusUpdating
199- 0 , // StatusReady
200+ 3 , // StatusCreating
201+ 0 , // StatusLive
200202 3 , // StatusStopping
201203 1 , // StatusStopped
202- 1 , // StatusError
203-
204- 0 , // StatusPendingUpdate
205- 2 , // StatusUpdateSkipped
206204}
207205
208- var _ = [1 ]int {}[int (StatusUpdateSkipped )- (len (statusSortBuckets )- 1 )] // Ensure list length matches
206+ var _ = [1 ]int {}[int (StatusStopped )- (len (statusSortBuckets )- 1 )] // Ensure list length matches
209207
210208func (code StatusCode ) String () string {
211209 if int (code ) < 0 || int (code ) >= len (statusCodes ) {
0 commit comments