Skip to content

Commit

Permalink
Review Comments Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
indrajit96 committed Nov 4, 2024
1 parent f745073 commit f07f5ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
19 changes: 8 additions & 11 deletions qa/L0_metrics/general_metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,22 @@ def get_model_load_times():
def load_model_explicit(model_name, server_url="http://localhost:8000"):
endpoint = f"{server_url}/v2/repository/models/{model_name}/load"
response = requests.post(endpoint)

if response.status_code == 200:
try:
self.assertEqual(response.status_code, 200)
print(f"Model '{model_name}' loaded successfully.")
else:
print(
f"Failed to load model '{model_name}'. Status code: {response.status_code}"
)
except AssertionError:
print(f"Failed to load model '{model_name}'. Status code: {response.status_code}")
print("Response:", response.text)


def unload_model_explicit(model_name, server_url="http://localhost:8000"):
endpoint = f"{server_url}/v2/repository/models/{model_name}/unload"
response = requests.post(endpoint)

if response.status_code == 200:
try:
self.assertEqual(response.status_code, 200)
print(f"Model '{model_name}' unloaded successfully.")
else:
except AssertionError:
print(
f"Failed to load model '{model_name}'. Status code: {response.status_code}"
f"Failed to unload model '{model_name}'. Status code: {response.status_code}"
)
print("Response:", response.text)

Expand Down
12 changes: 5 additions & 7 deletions qa/L0_metrics/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,32 @@ run_and_check_server
# Test 1 for default model control mode (all models loaded at startup)
python3 -m pytest --junitxml="general_metrics_test.test_metrics_load_time.report.xml" $CLIENT_PY::TestGeneralMetrics::test_metrics_load_time >> $CLIENT_LOG 2>&1
kill_server
set -e

set +e
CLIENT_PY="./general_metrics_test.py"
CLIENT_LOG="general_metrics_test_client.log"
SERVER_LOG="general_metrics_test_server.log"
SERVER_ARGS="$BASE_SERVER_ARGS --model-control-mode=explicit --log-verbose=1"
run_and_check_server
MODEL_NAME='libtorch_float32_float32_float32'
code=`curl -s -w %{http_code} -X POST ${TRITONSERVER_IPADDR}:8000/v2/repository/models/${MODEL_NAME}/load`
curl -s -w %{http_code} -X POST ${TRITONSERVER_IPADDR}:8000/v2/repository/models/${MODEL_NAME}/load
# Test 2 for explicit mode LOAD
python3 -m pytest --junitxml="general_metrics_test.test_metrics_load_time_explicit_load.report.xml" $CLIENT_PY::TestGeneralMetrics::test_metrics_load_time_explicit_load >> $CLIENT_LOG 2>&1

code=`curl -s -w %{http_code} -X POST ${TRITONSERVER_IPADDR}:8000/v2/repository/models/${MODEL_NAME}/unload`
curl -s -w %{http_code} -X POST ${TRITONSERVER_IPADDR}:8000/v2/repository/models/${MODEL_NAME}/unload
# Test 3 for explicit mode UNLOAD
python3 -m pytest --junitxml="general_metrics_test.test_metrics_load_time_explicit_unload.report.xml" $CLIENT_PY::TestGeneralMetrics::test_metrics_load_time_explicit_unload >> $CLIENT_LOG 2>&1
kill_server
set -e

# Test 4 for explicit mode LOAD and UNLOAD with multiple versions
set +e
CLIENT_PY="./general_metrics_test.py"
CLIENT_LOG="general_metrics_test_client.log"
SERVER_LOG="general_metrics_test_server.log"
VERSION_DIR="${PWD}/version_models"
SERVER_ARGS="$BASE_SERVER_ARGS --model-repository=${VERSION_DIR} --model-control-mode=explicit --log-verbose=1"
run_and_check_server
python3 -m pytest --junitxml="general_metrics_test.test_metrics_load_time_multiple_version_reload.report.xml" $CLIENT_PY::TestGeneralMetrics::test_metrics_load_time_multiple_version_reload >> $CLIENT_LOG 2>&1

kill_server
set -e

### Pinned memory metrics tests
set +e
Expand Down

0 comments on commit f07f5ef

Please sign in to comment.