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 2 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 @@ -208,7 +208,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 @@ -283,9 +283,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 @@ -297,15 +296,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 @@ -353,6 +352,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 @@ -460,10 +461,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 @@ -473,7 +474,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