Skip to content

Commit

Permalink
Merge pull request #3116 from cliveseldon/3106_graph_type
Browse files Browse the repository at this point in the history
Allow nil graph TYPE
  • Loading branch information
axsaucedo authored Apr 12, 2021
2 parents b7c89cd + c92a68e commit 2858011
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (r *SeldonDeploymentSpec) checkPredictiveUnits(pu *PredictiveUnit, p *Predi
allErrs = append(allErrs, field.Invalid(fldPath, pu.Name, "Can't find container for Predictive Unit"))
}

if *pu.Type == UNKNOWN_TYPE && (pu.Methods == nil || len(*pu.Methods) == 0) {
if pu.Type != nil && *pu.Type == UNKNOWN_TYPE && (pu.Methods == nil || len(*pu.Methods) == 0) {
allErrs = append(allErrs, field.Invalid(fldPath, pu.Name, "Predictive Unit has no implementation methods defined. Change to a known type or add what methods it defines"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,38 @@ func TestValidProtocolTransportServerType(t *testing.T) {
g.Expect(err).To(BeNil())
}

func TestNoGraphType(t *testing.T) {
g := NewGomegaWithT(t)
spec := &SeldonDeploymentSpec{
ServerType: ServerRPC,
Protocol: ProtocolTensorflow,
Transport: TransportGrpc,
Predictors: []PredictorSpec{
{
Name: "p1",
ComponentSpecs: []*SeldonPodSpec{
{
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Image: "seldonio/mock_classifier:1.0",
Name: "classifier",
},
},
},
},
},
Graph: PredictiveUnit{
Name: "classifier",
},
},
},
}

err := spec.ValidateSeldonDeployment()
g.Expect(err).To(BeNil())
}

func createScheme() *runtime.Scheme {
scheme := runtime.NewScheme()
_ = clientgoscheme.AddToScheme(scheme)
Expand Down

0 comments on commit 2858011

Please sign in to comment.