Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make graph a value rather than point in CRD types #1752

Merged
merged 4 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ type SeldonDeploymentSpec struct {

type PredictorSpec struct {
Name string `json:"name" protobuf:"string,1,opt,name=name"`
Graph *PredictiveUnit `json:"graph" protobuf:"bytes,2,opt,name=predictiveUnit"`
Graph PredictiveUnit `json:"graph" protobuf:"bytes,2,opt,name=predictiveUnit"`
ComponentSpecs []*SeldonPodSpec `json:"componentSpecs,omitempty" protobuf:"bytes,3,opt,name=componentSpecs"`
Replicas *int32 `json:"replicas,omitempty" protobuf:"string,4,opt,name=replicas"`
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,5,opt,name=annotations"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestGetDeploymentNameOneModel(t *testing.T) {
},
},
},
Graph: &PredictiveUnit{
Graph: PredictiveUnit{
Name: modelName,
},
},
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestGetDeploymentNameLong(t *testing.T) {
},
},
},
Graph: &PredictiveUnit{
Graph: PredictiveUnit{
Name: modelName,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ func (r *SeldonDeploymentSpec) DefaultSeldonDeployment(mldepName string, namespa
if _, present := p.Labels["version"]; !present {
p.Labels["version"] = p.Name
}
addDefaultsToGraph(p.Graph)

r.Predictors[i] = p
addDefaultsToGraph(&p.Graph)

for j := 0; j < len(p.ComponentSpecs); j++ {
cSpec := r.Predictors[i].ComponentSpecs[j]
Expand All @@ -299,15 +298,15 @@ func (r *SeldonDeploymentSpec) DefaultSeldonDeployment(mldepName string, namespa
getUpdatePortNumMap(con.Name, &nextPortNum, portMap)
portNum := portMap[con.Name]

pu := GetPredictiveUnit(p.Graph, con.Name)
pu := GetPredictiveUnit(&p.Graph, con.Name)

if pu != nil {
r.setContainerPredictiveUnitDefaults(j, portNum, &nextMetricsPortNum, mldepName, namespace, &p, pu, con)
}
}
}

pus := GetPredictiveUnitList(p.Graph)
pus := GetPredictiveUnitList(&p.Graph)

//some pus might not have a container spec so pick those up
for l := 0; l < len(pus); l++ {
Expand Down Expand Up @@ -355,6 +354,8 @@ func (r *SeldonDeploymentSpec) DefaultSeldonDeployment(mldepName string, namespa
}
}
}

r.Predictors[i] = p
adriangonz marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -462,10 +463,10 @@ func (r *SeldonDeploymentSpec) ValidateSeldonDeployment() error {
predictorNames := make(map[string]bool)
for i, p := range r.Predictors {

collectTransports(p.Graph, transports)
collectTransports(&p.Graph, transports)

_, noEngine := p.Annotations[ANNOTATION_NO_ENGINE]
if noEngine && sizeOfGraph(p.Graph) > 1 {
if noEngine && sizeOfGraph(&p.Graph) > 1 {
fldPath := field.NewPath("spec").Child("predictors").Index(i)
allErrs = append(allErrs, field.Invalid(fldPath, p.Name, "Running without engine only valid for single element graphs"))
}
Expand All @@ -475,7 +476,7 @@ func (r *SeldonDeploymentSpec) ValidateSeldonDeployment() error {
allErrs = append(allErrs, field.Invalid(fldPath, p.Name, "Duplicate predictor name"))
}
predictorNames[p.Name] = true
allErrs = checkPredictiveUnits(p.Graph, &p, field.NewPath("spec").Child("predictors").Index(i).Child("graph"), allErrs)
allErrs = checkPredictiveUnits(&p.Graph, &p, field.NewPath("spec").Child("predictors").Index(i).Child("graph"), allErrs)
}

if len(transports) > 1 {
Expand Down
Loading