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

Add ensemble parameter forwarding test #6284

Merged
merged 3 commits into from
Sep 11, 2023
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
62 changes: 62 additions & 0 deletions qa/L0_parameters/model_repository/ensemble/config.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

platform: "ensemble"
max_batch_size: 0

input [
{
name: "INPUT0"
data_type: TYPE_FP32
dims: [ 1 ]
}
]

output [
{
name: "key"
data_type: TYPE_STRING
dims: [ -1 ]
},
{
name: "value"
data_type: TYPE_STRING
dims: [ -1 ]
}
]

ensemble_scheduling
{
rmccorm4 marked this conversation as resolved.
Show resolved Hide resolved
step [
{
model_name: "parameter"
model_version: -1
input_map { key: "INPUT0", value: "INPUT0" }
output_map { key: "key", value: "key" }
output_map { key: "value", value: "value" }
}
]
}
45 changes: 19 additions & 26 deletions qa/L0_parameters/parameters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,20 @@ def create_inputs(self, client_type):
inputs[0].set_data_from_numpy(np.asarray([1], dtype=np.float32))
return inputs

async def send_request_and_verify(self, client_type, client, is_async=False):
async def send_request_and_verify(
self, client_type, client, is_async=False, model_name="parameter"
):
inputs = self.create_inputs(client_type)
for parameters in self.parameter_list:
# Setup infer callable to re-use below for brevity
infer_callable = partial(
client.infer,
model_name=model_name,
inputs=inputs,
parameters=parameters,
headers=self.headers,
)

# The `triton_` prefix is reserved for Triton usage
should_error = False
if "triton_" in parameters.keys():
Expand All @@ -105,38 +116,17 @@ async def send_request_and_verify(self, client_type, client, is_async=False):
if is_async:
if should_error:
with self.assertRaises(InferenceServerException):
result = await client.infer(
model_name="parameter",
inputs=inputs,
parameters=parameters,
headers=self.headers,
)
await infer_callable()
return
else:
result = await client.infer(
model_name="parameter",
inputs=inputs,
parameters=parameters,
headers=self.headers,
)

result = await infer_callable()
else:
if should_error:
with self.assertRaises(InferenceServerException):
result = client.infer(
model_name="parameter",
inputs=inputs,
parameters=parameters,
headers=self.headers,
)
infer_callable()
return
else:
result = client.infer(
model_name="parameter",
inputs=inputs,
parameters=parameters,
headers=self.headers,
)
result = infer_callable()

self.verify_outputs(result, parameters)

Expand Down Expand Up @@ -219,6 +209,9 @@ def test_grpc_stream_parameter(self):
self.verify_outputs(result, parameters)
self.grpc.stop_stream()

async def test_ensemble_parameter_forwarding(self):
await self.send_request_and_verify(httpclient, self.http, model_name="ensemble")

async def asyncTearDown(self):
self.http.close()
self.grpc.close()
Expand Down
7 changes: 5 additions & 2 deletions qa/L0_parameters/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ SERVER=/opt/tritonserver/bin/tritonserver
SERVER_LOG="./inference_server.log"
source ../common/util.sh

MODELDIR="model_repository"
mkdir -p "${MODELDIR}/ensemble/1"

# TODO: Add support and testing for C++ client parameters:
# https://jirasw.nvidia.com/browse/DLIS-4673

Expand All @@ -54,9 +57,9 @@ for i in {0..1}; do
# TEST_HEADER is a parameter used by `parameters_test.py` that controls
# whether the script will test for inclusion of headers in parameters or not.
if [ $i == 1 ]; then
SERVER_ARGS="--model-repository=model_repository --exit-timeout-secs=120 --grpc-header-forward-pattern my_header.* --http-header-forward-pattern my_header.*"
SERVER_ARGS="--model-repository=${MODELDIR} --exit-timeout-secs=120 --grpc-header-forward-pattern my_header.* --http-header-forward-pattern my_header.*"
else
SERVER_ARGS="--model-repository=model_repository --exit-timeout-secs=120"
SERVER_ARGS="--model-repository=${MODELDIR} --exit-timeout-secs=120"
fi
run_server
if [ "$SERVER_PID" == "0" ]; then
Expand Down