Skip to content

Commit 1a6094d

Browse files
Taking into account run count on timeout for runner (#330)
* Taking into account run count on timeout * bumping version to 0.2.32
1 parent 6520d3a commit 1a6094d

File tree

3 files changed

+72
-69
lines changed

3 files changed

+72
-69
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.2.31"
3+
version = "0.2.32"
44
description = "The Redis benchmarks specification describes the cross-language/tools requirements and expectations to foster performance and observability standards around redis related technologies. Members from both industry and academia, including organizations and individuals are encouraged to contribute."
55
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
66
readme = "Readme.md"

redis_benchmarks_specification/__compare__/compare.py

Lines changed: 54 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,15 +1253,11 @@ def process_single_test_comparison(
12531253
if baseline_str != "":
12541254
filters_baseline.append("{}={}".format(by_str_baseline, baseline_str))
12551255
if baseline_deployment_name != "":
1256-
filters_baseline.append(
1257-
"deployment_name={}".format(baseline_deployment_name)
1258-
)
1256+
filters_baseline.append("deployment_name={}".format(baseline_deployment_name))
12591257
if baseline_github_org != "":
12601258
filters_baseline.append(f"github_org={baseline_github_org}")
12611259
if running_platform_baseline is not None and running_platform_baseline != "":
1262-
filters_baseline.append(
1263-
"running_platform={}".format(running_platform_baseline)
1264-
)
1260+
filters_baseline.append("running_platform={}".format(running_platform_baseline))
12651261
filters_comparison = [
12661262
"metric={}".format(metric_name),
12671263
"{}={}".format(test_filter, test_name),
@@ -1282,10 +1278,7 @@ def process_single_test_comparison(
12821278
filters_baseline.append("hash==")
12831279
if "hash" not in by_str_comparison:
12841280
filters_comparison.append("hash==")
1285-
if (
1286-
running_platform_comparison is not None
1287-
and running_platform_comparison != ""
1288-
):
1281+
if running_platform_comparison is not None and running_platform_comparison != "":
12891282
filters_comparison.append(
12901283
"running_platform={}".format(running_platform_comparison)
12911284
)
@@ -1312,36 +1305,36 @@ def process_single_test_comparison(
13121305

13131306
# Initialize result dictionary
13141307
result = {
1315-
'skip_test': False,
1316-
'no_datapoints_baseline': False,
1317-
'no_datapoints_comparison': False,
1318-
'no_datapoints_both': False,
1319-
'baseline_only': False,
1320-
'comparison_only': False,
1321-
'detected_regression': False,
1322-
'detected_improvement': False,
1323-
'unstable': False,
1324-
'should_add_line': False,
1325-
'line': None,
1326-
'percentage_change': 0.0,
1327-
'tested_groups': tested_groups,
1328-
'tested_commands': tested_commands,
1329-
'boxplot_data': None,
1308+
"skip_test": False,
1309+
"no_datapoints_baseline": False,
1310+
"no_datapoints_comparison": False,
1311+
"no_datapoints_both": False,
1312+
"baseline_only": False,
1313+
"comparison_only": False,
1314+
"detected_regression": False,
1315+
"detected_improvement": False,
1316+
"unstable": False,
1317+
"should_add_line": False,
1318+
"line": None,
1319+
"percentage_change": 0.0,
1320+
"tested_groups": tested_groups,
1321+
"tested_commands": tested_commands,
1322+
"boxplot_data": None,
13301323
}
13311324

13321325
if len(baseline_timeseries) == 0:
13331326
logging.warning(
13341327
f"No datapoints for test={test_name} for baseline timeseries {baseline_timeseries}"
13351328
)
1336-
result['no_datapoints_baseline'] = True
1337-
result['no_datapoints_both'] = True
1329+
result["no_datapoints_baseline"] = True
1330+
result["no_datapoints_both"] = True
13381331

13391332
if len(comparison_timeseries) == 0:
13401333
logging.warning(
13411334
f"No datapoints for test={test_name} for comparison timeseries {comparison_timeseries}"
13421335
)
1343-
result['no_datapoints_comparison'] = True
1344-
result['no_datapoints_both'] = True
1336+
result["no_datapoints_comparison"] = True
1337+
result["no_datapoints_both"] = True
13451338

13461339
if len(baseline_timeseries) != 1 and multi_value_baseline is False:
13471340
if verbose:
@@ -1354,7 +1347,7 @@ def process_single_test_comparison(
13541347
logging.warning(
13551348
"\t\tTime-series: {}".format(", ".join(baseline_timeseries))
13561349
)
1357-
result['skip_test'] = True
1350+
result["skip_test"] = True
13581351
return result
13591352

13601353
if len(comparison_timeseries) > 1 and multi_value_comparison is False:
@@ -1364,7 +1357,7 @@ def process_single_test_comparison(
13641357
logging.warning(
13651358
"Comparison timeseries {}".format(len(comparison_timeseries))
13661359
)
1367-
result['skip_test'] = True
1360+
result["skip_test"] = True
13681361
return result
13691362

13701363
baseline_v = "N/A"
@@ -1383,9 +1376,7 @@ def process_single_test_comparison(
13831376
note = ""
13841377
try:
13851378
for ts_name_baseline in baseline_timeseries:
1386-
datapoints_inner = rts.ts().revrange(
1387-
ts_name_baseline, from_ts_ms, to_ts_ms
1388-
)
1379+
datapoints_inner = rts.ts().revrange(ts_name_baseline, from_ts_ms, to_ts_ms)
13891380
baseline_datapoints.extend(datapoints_inner)
13901381
(
13911382
baseline_pct_change,
@@ -1440,12 +1431,12 @@ def process_single_test_comparison(
14401431
logging.warning(
14411432
f"Baseline contains datapoints but comparison not for test: {test_name}"
14421433
)
1443-
result['baseline_only'] = True
1434+
result["baseline_only"] = True
14441435
if comparison_v != "N/A" and baseline_v == "N/A":
14451436
logging.warning(
14461437
f"Comparison contains datapoints but baseline not for test: {test_name}"
14471438
)
1448-
result['comparison_only'] = True
1439+
result["comparison_only"] = True
14491440
if (
14501441
baseline_v != "N/A"
14511442
and comparison_pct_change != "N/A"
@@ -1455,7 +1446,7 @@ def process_single_test_comparison(
14551446
if comparison_pct_change > 10.0 or baseline_pct_change > 10.0:
14561447
note = "UNSTABLE (very high variance)"
14571448
unstable = True
1458-
result['unstable'] = True
1449+
result["unstable"] = True
14591450

14601451
baseline_v_str = prepare_value_str(
14611452
baseline_pct_change,
@@ -1473,23 +1464,21 @@ def process_single_test_comparison(
14731464
)
14741465

14751466
if metric_mode == "higher-better":
1476-
percentage_change = (
1477-
float(comparison_v) / float(baseline_v) - 1
1478-
) * 100.0
1467+
percentage_change = (float(comparison_v) / float(baseline_v) - 1) * 100.0
14791468
else:
14801469
# lower-better
14811470
percentage_change = (
14821471
-(float(baseline_v) - float(comparison_v)) / float(baseline_v)
14831472
) * 100.0
14841473

14851474
# Collect data for box plot
1486-
result['boxplot_data'] = (test_name, percentage_change)
1475+
result["boxplot_data"] = (test_name, percentage_change)
14871476
else:
14881477
logging.warn(
14891478
f"Missing data for test {test_name}. baseline_v={baseline_v} (pct_change={baseline_pct_change}), comparison_v={comparison_v} (pct_change={comparison_pct_change}) "
14901479
)
14911480

1492-
result['percentage_change'] = percentage_change
1481+
result["percentage_change"] = percentage_change
14931482

14941483
if baseline_v != "N/A" or comparison_v != "N/A":
14951484
detected_regression = False
@@ -1545,8 +1534,8 @@ def process_single_test_comparison(
15451534
if simplify_table is False:
15461535
note = note + " No Change"
15471536

1548-
result['detected_regression'] = detected_regression
1549-
result['detected_improvement'] = detected_improvement
1537+
result["detected_regression"] = detected_regression
1538+
result["detected_improvement"] = detected_improvement
15501539

15511540
line = get_line(
15521541
baseline_v_str,
@@ -1555,12 +1544,12 @@ def process_single_test_comparison(
15551544
percentage_change,
15561545
test_link,
15571546
)
1558-
result['line'] = line
1547+
result["line"] = line
15591548
else:
15601549
logging.warning(
15611550
"There were no datapoints both for baseline and comparison for test: {test_name}"
15621551
)
1563-
result['no_datapoints_both'] = True
1552+
result["no_datapoints_both"] = True
15641553

15651554
return result
15661555

@@ -1676,49 +1665,49 @@ def process_test_wrapper(test_name):
16761665
# Second loop: Process all collected results
16771666
for test_name, result in test_results:
16781667
# Handle the results from the extracted function
1679-
if result['skip_test']:
1668+
if result["skip_test"]:
16801669
continue
16811670

1682-
if result['no_datapoints_baseline']:
1671+
if result["no_datapoints_baseline"]:
16831672
no_datapoints_baseline_list.append(test_name)
16841673
if test_name not in no_datapoints_list:
16851674
no_datapoints_list.append(test_name)
16861675

1687-
if result['no_datapoints_comparison']:
1676+
if result["no_datapoints_comparison"]:
16881677
no_datapoints_comparison_list.append(test_name)
16891678
if test_name not in no_datapoints_list:
16901679
no_datapoints_list.append(test_name)
16911680

1692-
if result['baseline_only']:
1681+
if result["baseline_only"]:
16931682
baseline_only_list.append(test_name)
16941683

1695-
if result['comparison_only']:
1684+
if result["comparison_only"]:
16961685
comparison_only_list.append(test_name)
16971686

1698-
if result['unstable']:
1687+
if result["unstable"]:
16991688
unstable_list.append([test_name, "n/a"])
17001689

1701-
if result['boxplot_data']:
1702-
boxplot_data.append(result['boxplot_data'])
1690+
if result["boxplot_data"]:
1691+
boxplot_data.append(result["boxplot_data"])
17031692

17041693
# Handle group and command changes
1705-
for test_group in result['tested_groups']:
1694+
for test_group in result["tested_groups"]:
17061695
if test_group not in group_change:
17071696
group_change[test_group] = []
1708-
group_change[test_group].append(result['percentage_change'])
1697+
group_change[test_group].append(result["percentage_change"])
17091698

1710-
for test_command in result['tested_commands']:
1699+
for test_command in result["tested_commands"]:
17111700
if test_command not in command_change:
17121701
command_change[test_command] = []
1713-
command_change[test_command].append(result['percentage_change'])
1702+
command_change[test_command].append(result["percentage_change"])
17141703

17151704
# Handle regression/improvement detection and table updates
1716-
if result['line'] is not None:
1717-
detected_regression = result['detected_regression']
1718-
detected_improvement = result['detected_improvement']
1719-
unstable = result['unstable']
1720-
line = result['line']
1721-
percentage_change = result['percentage_change']
1705+
if result["line"] is not None:
1706+
detected_regression = result["detected_regression"]
1707+
detected_improvement = result["detected_improvement"]
1708+
unstable = result["unstable"]
1709+
line = result["line"]
1710+
percentage_change = result["percentage_change"]
17221711

17231712
if detected_regression:
17241713
total_regressions = total_regressions + 1
@@ -1752,7 +1741,7 @@ def process_test_wrapper(test_name):
17521741
if should_add_line:
17531742
total_comparison_points = total_comparison_points + 1
17541743
table_full.append(line)
1755-
elif result['no_datapoints_both']:
1744+
elif result["no_datapoints_both"]:
17561745
if test_name not in no_datapoints_list:
17571746
no_datapoints_list.append(test_name)
17581747
logging.warning(

redis_benchmarks_specification/__runner__/runner.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,28 @@ def calculate_process_timeout(command_str, buffer_timeout):
354354
int: Timeout in seconds
355355
"""
356356
default_timeout = 300 # 5 minutes default
357+
run_count = 1
358+
if "run-count" in command_str:
359+
# Try to extract test time and add buffer
360+
# Handle both --test-time (memtier) and -test-time (pubsub-sub-bench)
361+
run_count_match = re.search(r"--?run-count[=\s]+(\d+)", command_str)
362+
if run_count_match:
363+
run_count = int(run_count_match.group(1))
364+
logging.info(f"Detected run count of: {run_count}")
365+
run_count_match = re.search(r"-?x[=\s]+(\d+)", command_str)
366+
if run_count_match:
367+
run_count = int(run_count_match.group(1))
368+
logging.info(f"Detected run count (from -x) of: {run_count}")
357369

358370
if "test-time" in command_str:
359371
# Try to extract test time and add buffer
360372
# Handle both --test-time (memtier) and -test-time (pubsub-sub-bench)
361373
test_time_match = re.search(r"--?test-time[=\s]+(\d+)", command_str)
362374
if test_time_match:
363375
test_time = int(test_time_match.group(1))
364-
timeout = test_time + buffer_timeout
376+
timeout = (test_time + buffer_timeout) * run_count
365377
logging.info(
366-
f"Set process timeout to {timeout}s (test-time: {test_time}s + {buffer_timeout}s buffer)"
378+
f"Set process timeout to {timeout}s (test-time: {test_time}s + {buffer_timeout}s buffer) x {run_count} runs)"
367379
)
368380
return timeout
369381

@@ -1590,7 +1602,9 @@ def delete_temporary_files(
15901602
logging.info(f"Using override topology: {args.override_topology}")
15911603
else:
15921604
benchmark_topologies = benchmark_config["redis-topologies"]
1593-
logging.info(f"Running for a total of {len(benchmark_topologies)} topologies: {benchmark_topologies}")
1605+
logging.info(
1606+
f"Running for a total of {len(benchmark_topologies)} topologies: {benchmark_topologies}"
1607+
)
15941608

15951609
# Check if user requested exit via Ctrl+C
15961610
if _exit_requested:

0 commit comments

Comments
 (0)