Skip to content

Commit 4781530

Browse files
committed
Add dsr1 and gpt-oss test cases
Signed-off-by: Chenfei Zhang <[email protected]>
1 parent 129290d commit 4781530

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

tests/integration/defs/perf/open_search_db_utils.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import re
2121
import sys
2222
import time
23+
from datetime import datetime
2324

2425
from defs.trt_test_alternative import print_info
2526

@@ -198,7 +199,7 @@ def get_job_info():
198199
}
199200

200201

201-
def query_history_data():
202+
def query_history_data(gpu_type):
202203
"""
203204
Query post-merge data with specific gpu type and model name
204205
"""
@@ -218,6 +219,16 @@ def query_history_data():
218219
"b_is_post_merge": True
219220
}
220221
},
222+
{
223+
"term": {
224+
"b_is_regression": False
225+
}
226+
},
227+
{
228+
"term": {
229+
"s_gpu_type": gpu_type
230+
}
231+
},
221232
{
222233
"range": {
223234
"ts_created": {
@@ -348,27 +359,42 @@ def calculate_best_perf_result(history_data_list, new_data):
348359
return best_metrics
349360

350361

351-
def get_history_data(new_data_dict):
362+
def get_history_data(new_data_dict, gpu_type):
352363
"""
353364
Query history post-merge data for each cmd_idx
354365
"""
366+
367+
def get_latest_data(data_list):
368+
if not data_list:
369+
return None
370+
time_format = "%b %d, %Y @ %H:%M:%S.%f"
371+
# Find the item with the maximum ts_created value
372+
latest_data = max(
373+
data_list,
374+
key=lambda x: datetime.strptime(x["ts_created"], time_format))
375+
return latest_data
376+
355377
history_baseline_dict = {}
356378
history_data_dict = {}
357379
cmd_idxs = new_data_dict.keys()
358380
for cmd_idx in cmd_idxs:
359381
history_data_dict[cmd_idx] = []
360-
history_baseline_dict[cmd_idx] = None
361-
history_data_list = query_history_data()
382+
history_baseline_dict[cmd_idx] = []
383+
history_data_list = query_history_data(gpu_type)
362384
if history_data_list:
363385
for history_data in history_data_list:
364386
for cmd_idx in cmd_idxs:
365387
if match(history_data, new_data_dict[cmd_idx]):
366388
if history_data.get("b_is_baseline") and history_data.get(
367389
"b_is_baseline") == True:
368-
history_baseline_dict[cmd_idx] = history_data
390+
history_baseline_dict[cmd_idx].append(history_data)
369391
else:
370392
history_data_dict[cmd_idx].append(history_data)
371393
break
394+
# Sometime database has several baselines and we only use the latest baseline one
395+
for cmd_idx, baseline_list in history_baseline_dict:
396+
latest_baseline = get_latest_data(baseline_list)
397+
history_baseline_dict[cmd_idx] = latest_baseline
372398
return history_baseline_dict, history_data_dict
373399

374400

tests/integration/defs/perf/test_perf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ def upload_test_results_to_database(self):
21942194

21952195
# Get history data for each cmd_idx
21962196
history_baseline_dict, history_data_dict = get_history_data(
2197-
new_data_dict)
2197+
new_data_dict, self._config.gpu_type)
21982198
# Prepare regressive test cases
21992199
regressive_data_list = prepare_regressive_test_cases(
22002200
history_baseline_dict, new_data_dict)

0 commit comments

Comments
 (0)