Skip to content

Commit

Permalink
rename field to Response, re-generate code
Browse files Browse the repository at this point in the history
Signed-off-by: asd981256 <asd981256@gmail.com>
  • Loading branch information
asd981256 committed May 14, 2024
1 parent f47bb9a commit 9684f3d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 45 deletions.
6 changes: 3 additions & 3 deletions cmd/router/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ func routeStep(nodeName string, graph v1alpha1.InferenceGraphSpec, input []byte,
if responseBytes, statusCode, err = executeStep(step, graph, request, headers); err != nil {
return nil, 500, err
}
// collect responses if BeMerged is set
if step.BeMerged == true || i == len(currentNode.Steps)-1 {
// collect responses if Response is set
if step.Response == true || i == len(currentNode.Steps)-1 {
key := step.StepName
if key == "" {
key = strconv.Itoa(i) // Use index if no step name
Expand All @@ -277,7 +277,7 @@ func routeStep(nodeName string, graph v1alpha1.InferenceGraphSpec, input []byte,
}
}
}
// If no BeMerged set, maintain same behavior
// If no other step response need to return
if len(combinedResponses) == 1 {
return responseBytes, statusCode, nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/router/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func TestMergeSequenceStepsResponses(t *testing.T) {
ServiceURL: model2Url.String(),
},
Data: "$response",
BeMerged: true,
Response: true,
},
{
StepName: "model3",
Expand Down
4 changes: 2 additions & 2 deletions config/crd/full/serving.kserve.io_inferencegraphs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ spec:
steps:
items:
properties:
beMerged:
type: boolean
condition:
type: string
data:
Expand All @@ -435,6 +433,8 @@ spec:
type: string
nodeName:
type: string
response:
type: boolean
serviceName:
type: string
serviceUrl:
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/serving/v1alpha1/inference_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ type InferenceStep struct {
// +optional
Dependency InferenceStepDependencyType `json:"dependency,omitempty"`

// specify this step response alongside final steps response in sequence node
// specify this step response be return alongside final steps response in sequence node
// final step response will always be returned
// +optional
BeMerged bool `json:"beMerged,omitempty"`
Response bool `json:"response,omitempty"`
}

// InferenceGraphStatus defines the InferenceGraph conditions and status
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/serving/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/apis/serving/v1beta1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@
"description": "InferenceStep defines the inference target of the current step with condition, weights and data.",
"type": "object",
"properties": {
"beMerged": {
"description": "specify this step response alongside final steps response in sequence node",
"type": "boolean"
},
"condition": {
"description": "routing based on the condition",
"type": "string"
Expand All @@ -330,6 +326,10 @@
"description": "The node name for routing as next step",
"type": "string"
},
"response": {
"description": "specify this step response be return alongside final steps response in sequence node final step response will always be returned",
"type": "boolean"
},
"serviceName": {
"description": "named reference for InferenceService",
"type": "string"
Expand Down
1 change: 1 addition & 0 deletions python/kserve/docs/V1alpha1InferenceStep.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Name | Type | Description | Notes
**dependency** | **str** | to decide whether a step is a hard or a soft dependency in the Inference Graph | [optional]
**name** | **str** | Unique name for the step within this node | [optional]
**node_name** | **str** | The node name for routing as next step | [optional]
**response** | **bool** | specify this step response be return alongside final steps response in sequence node final step response will always be returned | [optional]
**service_name** | **str** | named reference for InferenceService | [optional]
**service_url** | **str** | InferenceService URL, mutually exclusive with ServiceName | [optional]
**weight** | **int** | the weight for split of the traffic, only used for Split Router when weight is specified all the routing targets should be sum to 100 | [optional]
Expand Down
58 changes: 29 additions & 29 deletions python/kserve/kserve/models/v1alpha1_inference_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,48 +47,46 @@ class V1alpha1InferenceStep(object):
and the value is json key in definition.
"""
openapi_types = {
'be_merged': 'bool',
'condition': 'str',
'data': 'str',
'dependency': 'str',
'name': 'str',
'node_name': 'str',
'response': 'bool',
'service_name': 'str',
'service_url': 'str',
'weight': 'int'
}

attribute_map = {
'be_merged': 'beMerged',
'condition': 'condition',
'data': 'data',
'dependency': 'dependency',
'name': 'name',
'node_name': 'nodeName',
'response': 'response',
'service_name': 'serviceName',
'service_url': 'serviceUrl',
'weight': 'weight'
}

def __init__(self, be_merged=None, condition=None, data=None, dependency=None, name=None, node_name=None, service_name=None, service_url=None, weight=None, local_vars_configuration=None): # noqa: E501
def __init__(self, condition=None, data=None, dependency=None, name=None, node_name=None, response=None, service_name=None, service_url=None, weight=None, local_vars_configuration=None): # noqa: E501
"""V1alpha1InferenceStep - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration

self._be_merged = None
self._condition = None
self._data = None
self._dependency = None
self._name = None
self._node_name = None
self._response = None
self._service_name = None
self._service_url = None
self._weight = None
self.discriminator = None

if be_merged is not None:
self.be_merged = be_merged
if condition is not None:
self.condition = condition
if data is not None:
Expand All @@ -99,36 +97,15 @@ def __init__(self, be_merged=None, condition=None, data=None, dependency=None, n
self.name = name
if node_name is not None:
self.node_name = node_name
if response is not None:
self.response = response
if service_name is not None:
self.service_name = service_name
if service_url is not None:
self.service_url = service_url
if weight is not None:
self.weight = weight

@property
def be_merged(self):
"""Gets the be_merged of this V1alpha1InferenceStep. # noqa: E501
specify this step response alongside final steps response in sequence node # noqa: E501
:return: The be_merged of this V1alpha1InferenceStep. # noqa: E501
:rtype: bool
"""
return self._be_merged

@be_merged.setter
def be_merged(self, be_merged):
"""Sets the be_merged of this V1alpha1InferenceStep.
specify this step response alongside final steps response in sequence node # noqa: E501
:param be_merged: The be_merged of this V1alpha1InferenceStep. # noqa: E501
:type: bool
"""

self._be_merged = be_merged

@property
def condition(self):
"""Gets the condition of this V1alpha1InferenceStep. # noqa: E501
Expand Down Expand Up @@ -244,6 +221,29 @@ def node_name(self, node_name):

self._node_name = node_name

@property
def response(self):
"""Gets the response of this V1alpha1InferenceStep. # noqa: E501
specify this step response be return alongside final steps response in sequence node final step response will always be returned # noqa: E501
:return: The response of this V1alpha1InferenceStep. # noqa: E501
:rtype: bool
"""
return self._response

@response.setter
def response(self, response):
"""Sets the response of this V1alpha1InferenceStep.
specify this step response be return alongside final steps response in sequence node final step response will always be returned # noqa: E501
:param response: The response of this V1alpha1InferenceStep. # noqa: E501
:type: bool
"""

self._response = response

@property
def service_name(self):
"""Gets the service_name of this V1alpha1InferenceStep. # noqa: E501
Expand Down
4 changes: 2 additions & 2 deletions test/crds/serving.kserve.io_inferenceservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2978,8 +2978,6 @@ spec:
steps:
items:
properties:
beMerged:
type: boolean
condition:
type: string
data:
Expand All @@ -2993,6 +2991,8 @@ spec:
type: string
nodeName:
type: string
response:
type: boolean
serviceName:
type: string
serviceUrl:
Expand Down

0 comments on commit 9684f3d

Please sign in to comment.