MCPcopy Index your code
hub / github.com/cortexlabs/cortex / isAPIUpdating

Function isAPIUpdating

pkg/operator/resources/realtimeapi/api.go:396–414  ·  view source on GitHub ↗

returns true if min_replicas are not ready and no updated replicas have errored

(deployment *kapps.Deployment)

Source from the content-addressed store, hash-verified

394
395// returns true if min_replicas are not ready and no updated replicas have errored
396func isAPIUpdating(deployment *kapps.Deployment) (bool, error) {
397 pods, err := config.K8s.ListPodsByLabel("apiName", deployment.Labels["apiName"])
398 if err != nil {
399 return false, err
400 }
401
402 replicaCounts := GetReplicaCounts(deployment, pods)
403
404 autoscalingSpec, err := userconfig.AutoscalingFromAnnotations(deployment)
405 if err != nil {
406 return false, err
407 }
408
409 if replicaCounts.Ready < autoscalingSpec.MinReplicas && replicaCounts.TotalFailed() == 0 {
410 return true, nil
411 }
412
413 return false, nil
414}
415
416func isPodSpecLatest(deployment *kapps.Deployment, pod *kcore.Pod) bool {
417 return deployment.Spec.Template.Labels["podID"] == pod.Labels["podID"] &&

Callers 2

UpdateAPIFunction · 0.70
RefreshAPIFunction · 0.70

Calls 4

ListPodsByLabelMethod · 0.80
TotalFailedMethod · 0.80
GetReplicaCountsFunction · 0.70

Tested by

no test coverage detected