-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
test: TC for Metric P0 nv_load_time per model #7697
base: main
Are you sure you want to change the base?
Changes from 6 commits
c9e8c6a
5b1f62f
d421e49
d47ebe5
3fcc649
8447d01
748d3c5
b93d774
9f3f577
0cfd16c
f745073
f07f5ef
b752a5b
513a301
9329e55
fdf05c7
4764717
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come the core PR was merged way before this one finished? We currently have no ongoing tests for the merged feature on our nightly pipelines in core, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was approved in parallel. A couple of days appart. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# /usr/bin/python | ||
# Copyright 2024, 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. | ||
|
||
import os | ||
import re | ||
import unittest | ||
|
||
import requests | ||
|
||
_tritonserver_ipaddr = os.environ.get("TRITONSERVER_IPADDR", "localhost") | ||
MODEL_LOAD_TIME = "nv_model_load_duration_secs{model=" | ||
|
||
|
||
def get_model_load_times(): | ||
r = requests.get(f"http://{_tritonserver_ipaddr}:8002/metrics") | ||
r.raise_for_status() | ||
pattern = re.compile(rf'{MODEL_LOAD_TIME}"(.*?)".*?\ (\d+\.\d+)') | ||
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved
Hide resolved
|
||
model_load_times = {} | ||
matches = pattern.findall(r.text) | ||
for match in matches: | ||
model_name, load_time = match | ||
model_load_times[model_name] = float(load_time) | ||
return model_load_times | ||
|
||
|
||
class TestGeneralMetrics(unittest.TestCase): | ||
def setUp(self): | ||
self.model_name = "libtorch_float32_float32_float32" | ||
|
||
def test_metrics_load_time(self): | ||
model_load_times = get_model_load_times() | ||
load_time = model_load_times.get(self.model_name) | ||
|
||
self.assertIsNotNone(load_time, "Model Load time not found") | ||
|
||
dict_size = len(model_load_times) | ||
self.assertEqual(dict_size, 1, "Too many model_load_time entries found") | ||
|
||
def test_metrics_load_time_explicit_load(self): | ||
model_load_times = get_model_load_times() | ||
load_time = model_load_times.get(self.model_name) | ||
|
||
self.assertIsNotNone(load_time, "Model Load time not found") | ||
|
||
dict_size = len(model_load_times) | ||
self.assertEqual(dict_size, 1, "Too many model_load_time entries found") | ||
|
||
def test_metrics_load_time_explicit_unload(self): | ||
model_load_times = get_model_load_times() | ||
load_time = model_load_times.get(self.model_name) | ||
|
||
self.assertIsNone(load_time, "Model Load time found even after unload") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a sample output for a gauge metric?