MCPcopy Create free account
hub / github.com/SeldonIO/seldon-core / TestUpdateModelState

Function TestUpdateModelState

scheduler/pkg/store/memory_test.go:989–1356  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

987}
988
989func TestUpdateModelState(t *testing.T) {
990 g := NewGomegaWithT(t)
991 memBytes := uint64(1)
992
993 type test struct {
994 name string
995 store *LocalSchedulerStore
996 modelKey string
997 version uint32
998 serverKey string
999 replicaIdx int
1000 expectedState ModelReplicaState
1001 desiredState ModelReplicaState
1002 availableMemory uint64
1003 modelRuntimeInfo *pb.ModelRuntimeInfo
1004 numModelVersionsLoaded int
1005 modelVersionLoaded bool
1006 deleted bool
1007 err bool
1008 }
1009
1010 tests := []test{
1011 {
1012 name: "LoadedModel",
1013 store: &LocalSchedulerStore{
1014 models: map[string]*Model{"model": {
1015 versions: []*ModelVersion{
1016 {
1017 modelDefn: &pb.Model{ModelSpec: &pb.ModelSpec{MemoryBytes: &memBytes}},
1018 version: 1,
1019 replicas: map[int]ReplicaStatus{},
1020 },
1021 },
1022 }},
1023 servers: map[string]*Server{
1024 "server": {
1025 name: "server",
1026 replicas: map[int]*ServerReplica{
1027 0: {loadedModels: map[ModelVersionID]bool{}, reservedMemory: memBytes, uniqueLoadedModels: map[string]bool{}},
1028 1: {loadedModels: map[ModelVersionID]bool{}, reservedMemory: memBytes, uniqueLoadedModels: map[string]bool{}},
1029 },
1030 },
1031 },
1032 },
1033 modelKey: "model",
1034 version: 1,
1035 serverKey: "server",
1036 replicaIdx: 0,
1037 expectedState: ModelReplicaStateUnknown,
1038 desiredState: Loaded,
1039 numModelVersionsLoaded: 1,
1040 modelVersionLoaded: true,
1041 availableMemory: 20,
1042 modelRuntimeInfo: &pb.ModelRuntimeInfo{ModelRuntimeInfo: &pb.ModelRuntimeInfo_Mlserver{Mlserver: &pb.MLServerModelSettings{ParallelWorkers: uint32(1)}}},
1043 },
1044 {
1045 name: "UnloadedModel",
1046 store: &LocalSchedulerStore{

Callers

nothing calls this directly

Calls 15

UpdateModelStateMethod · 0.95
NewMemoryStoreFunction · 0.85
toUniqueModelsFunction · 0.85
RunMethod · 0.80
SetDeletedMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
LatestMethod · 0.80
GetReservedMemoryMethod · 0.80
GetRequiredMemoryMethod · 0.80

Tested by

no test coverage detected