Skip to content

Commit 944efa1

Browse files
Enabled passing baseline/comparison hash and github_repo to ensure proper data filtering on compare. Removed refs/heads/ usage from builder (#265)
* Enabled running forks source built benchmarks * Fixed server_name Null check * Enabled passing baseline/comparison hash and github_repo to ensure proper data filtering on compare. Removed refs/heads/ usage from builder * skipping cli builder test on ci
1 parent 7678cea commit 944efa1

File tree

6 files changed

+86
-12
lines changed

6 files changed

+86
-12
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.1.217"
3+
version = "0.1.218"
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/__cli__/cli.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,22 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
351351
hash_regexp
352352
)
353353
)
354+
enable_hash_filtering = False
355+
hash_filters = []
356+
if args.git_hash != "":
357+
enable_hash_filtering = True
358+
hash_filters = args.git_hash.split(",")
359+
logging.info(
360+
f"There is a total of {len(hash_filters)} commit hash fitlers: {hash_filters}"
361+
)
354362
hash_regexp_string = re.compile(hash_regexp)
355363
filtered_hash_commits = []
356364
for cdict in commits:
357365
commit_hash = cdict["git_hash"]
358-
if args.git_hash != "":
359-
if args.git_hash != commit_hash:
366+
if enable_hash_filtering:
367+
if commit_hash not in hash_filters:
360368
logging.info(
361-
"Skipping {} given it does not match commit hash {}".format(
362-
commit_hash, args.git_hash
363-
)
369+
f"Skipping {commit_hash} given it does not match any commit hash in {hash_filters}"
364370
)
365371
continue
366372
commit_summary = cdict["commit_summary"]

redis_benchmarks_specification/__common__/builder_schema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ def get_branch_version_from_test_details(testDetails):
174174
git_branch = git_branch.decode()
175175
if git_branch.startswith("/refs/heads/"):
176176
git_branch = git_branch.replace("/refs/heads/", "")
177+
if git_branch.startswith("refs/heads/"):
178+
git_branch = git_branch.replace("refs/heads/", "")
179+
if git_branch.startswith("/"):
180+
git_branch = git_branch[1:]
177181
if git_version is not None:
178182
if type(git_version) == bytes:
179183
git_version = git_version.decode()

redis_benchmarks_specification/__compare__/args.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,19 @@ def create_compare_arguments(parser):
9292
)
9393
parser.add_argument("--baseline-branch", type=str, default=None, required=False)
9494
parser.add_argument("--baseline-tag", type=str, default=None, required=False)
95+
parser.add_argument("--baseline-hash", type=str, default=None, required=False)
9596
parser.add_argument(
9697
"--baseline-target-version", type=str, default=None, required=False
9798
)
9899
parser.add_argument("--comparison-branch", type=str, default=None, required=False)
100+
parser.add_argument(
101+
"--baseline-github-repo", type=str, default="redis", required=False
102+
)
103+
parser.add_argument(
104+
"--comparison-github-repo", type=str, default="redis", required=False
105+
)
99106
parser.add_argument("--comparison-tag", type=str, default=None, required=False)
107+
parser.add_argument("--comparison-hash", type=str, default=None, required=False)
100108
parser.add_argument(
101109
"--comparison-target-version", type=str, default=None, required=False
102110
)

redis_benchmarks_specification/__compare__/compare.py

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ def compare_command_logic(args, project_name, project_version):
250250
running_platform = args.running_platform
251251
baseline_target_version = args.baseline_target_version
252252
comparison_target_version = args.comparison_target_version
253+
baseline_github_repo = args.baseline_github_repo
254+
comparison_github_repo = args.comparison_github_repo
255+
baseline_hash = args.baseline_hash
256+
comparison_hash = args.comparison_hash
253257

254258
if running_platform is not None:
255259
logging.info(
@@ -310,6 +314,10 @@ def compare_command_logic(args, project_name, project_version):
310314
running_platform,
311315
baseline_target_version,
312316
comparison_target_version,
317+
baseline_hash,
318+
comparison_hash,
319+
baseline_github_repo,
320+
comparison_github_repo,
313321
)
314322
prepare_regression_comment(
315323
auto_approve,
@@ -535,6 +543,10 @@ def compute_regression_table(
535543
running_platform=None,
536544
baseline_target_version=None,
537545
comparison_target_version=None,
546+
comparison_hash=None,
547+
baseline_hash=None,
548+
baseline_github_repo="redis",
549+
comparison_github_repo="redis",
538550
):
539551
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
540552
START_TIME_LAST_MONTH_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=31)
@@ -560,6 +572,8 @@ def compute_regression_table(
560572
comparison_tag,
561573
baseline_target_version,
562574
comparison_target_version,
575+
comparison_hash,
576+
baseline_hash,
563577
)
564578
logging.info(f"Using baseline filter {by_str_baseline}={baseline_str}")
565579
logging.info(f"Using comparison filter {by_str_comparison}={comparison_str}")
@@ -605,6 +619,8 @@ def compute_regression_table(
605619
total_stable,
606620
total_unstable,
607621
total_comparison_points,
622+
regressions_list,
623+
improvements_list,
608624
) = from_rts_to_regression_table(
609625
baseline_deployment_name,
610626
comparison_deployment_name,
@@ -629,6 +645,8 @@ def compute_regression_table(
629645
tf_triggering_env,
630646
verbose,
631647
running_platform,
648+
baseline_github_repo,
649+
comparison_github_repo,
632650
)
633651
logging.info(
634652
"Printing differential analysis between {} and {}".format(
@@ -661,6 +679,8 @@ def compute_regression_table(
661679
writer_regressions.dump(mystdout, False)
662680
table_output += mystdout.getvalue()
663681
table_output += "\n\n"
682+
test_names_str = "|".join(regressions_list)
683+
table_output += f"Regressions test regexp names: {test_names_str}\n\n"
664684
mystdout.close()
665685
sys.stdout = old_stdout
666686

@@ -682,6 +702,8 @@ def compute_regression_table(
682702
writer_regressions.dump(mystdout, False)
683703
table_output += mystdout.getvalue()
684704
table_output += "\n\n"
705+
test_names_str = "|".join(improvements_list)
706+
table_output += f"Improvements test regexp names: {test_names_str}\n\n"
685707
mystdout.close()
686708
sys.stdout = old_stdout
687709

@@ -724,6 +746,8 @@ def get_by_strings(
724746
comparison_tag,
725747
baseline_target_version=None,
726748
comparison_target_version=None,
749+
baseline_hash=None,
750+
comparison_hash=None,
727751
):
728752
baseline_covered = False
729753
comparison_covered = False
@@ -760,6 +784,16 @@ def get_by_strings(
760784
by_str_baseline = "target+version"
761785
baseline_str = baseline_target_version
762786

787+
if baseline_hash is not None:
788+
if comparison_covered:
789+
logging.error(
790+
"--baseline-branch, --baseline-tag, --baseline-hash, and --baseline-target-version are mutually exclusive. Pick one..."
791+
)
792+
exit(1)
793+
baseline_covered = True
794+
by_str_baseline = "hash"
795+
baseline_str = baseline_hash
796+
763797
if comparison_tag is not None:
764798
# check if we had already covered comparison
765799
if comparison_covered:
@@ -781,16 +815,27 @@ def get_by_strings(
781815
by_str_comparison = "target+version"
782816
comparison_str = comparison_target_version
783817

818+
if comparison_hash is not None:
819+
# check if we had already covered comparison
820+
if comparison_covered:
821+
logging.error(
822+
"--comparison-branch, --comparison-tag, --comparison-hash, and --comparison-target-table are mutually exclusive. Pick one..."
823+
)
824+
exit(1)
825+
comparison_covered = True
826+
by_str_comparison = "hash"
827+
comparison_str = comparison_hash
828+
784829
if baseline_covered is False:
785830
logging.error(
786831
"You need to provider either "
787-
+ "( --baseline-branch, --baseline-tag, or --baseline-target-version ) "
832+
+ "( --baseline-branch, --baseline-tag, --baseline-hash, or --baseline-target-version ) "
788833
)
789834
exit(1)
790835
if comparison_covered is False:
791836
logging.error(
792837
"You need to provider either "
793-
+ "( --comparison-branch, --comparison-tag, or --comparison-target-version ) "
838+
+ "( --comparison-branch, --comparison-tag, --comparison-hash, or --comparison-target-version ) "
794839
)
795840
exit(1)
796841
return baseline_str, by_str_baseline, comparison_str, by_str_comparison
@@ -820,6 +865,8 @@ def from_rts_to_regression_table(
820865
tf_triggering_env,
821866
verbose,
822867
running_platform=None,
868+
baseline_github_repo="redis",
869+
comparison_github_repo="redis",
823870
):
824871
print_all = print_regressions_only is False and print_improvements_only is False
825872
table_full = []
@@ -835,6 +882,8 @@ def from_rts_to_regression_table(
835882
total_comparison_points = 0
836883
noise_waterline = 3
837884
progress = tqdm(unit="benchmark time-series", total=len(test_names))
885+
regressions_list = []
886+
improvements_list = []
838887
for test_name in test_names:
839888
compare_version = "v0.1.208"
840889
github_link = "https://github.com/redis/redis-benchmarks-specification/blob"
@@ -848,18 +897,23 @@ def from_rts_to_regression_table(
848897
"metric={}".format(metric_name),
849898
"{}={}".format(test_filter, test_name),
850899
"deployment_name={}".format(baseline_deployment_name),
900+
"github_repo={}".format(baseline_github_repo),
851901
"triggering_env={}".format(tf_triggering_env),
852902
]
853903
if running_platform is not None:
854904
filters_baseline.append("running_platform={}".format(running_platform))
855905
filters_comparison = [
856906
"{}={}".format(by_str_comparison, comparison_str),
857907
"metric={}".format(metric_name),
858-
"hash==",
859908
"{}={}".format(test_filter, test_name),
860909
"deployment_name={}".format(comparison_deployment_name),
910+
"github_repo={}".format(comparison_github_repo),
861911
"triggering_env={}".format(tf_triggering_env),
862912
]
913+
if "hash" not in by_str_baseline:
914+
filters_baseline.append("hash==")
915+
if "hash" not in by_str_comparison:
916+
filters_comparison.append("hash==")
863917
if running_platform is not None:
864918
filters_comparison.append("running_platform={}".format(running_platform))
865919
baseline_timeseries = rts.ts().queryindex(filters_baseline)
@@ -1037,9 +1091,11 @@ def from_rts_to_regression_table(
10371091
test_link,
10381092
)
10391093
if detected_regression:
1094+
regressions_list.append(test_name)
10401095
table_regressions.append(line)
10411096

10421097
if detected_improvement:
1098+
improvements_list.append(test_name)
10431099
table_improvements.append(line)
10441100

10451101
if unstable:
@@ -1072,6 +1128,8 @@ def from_rts_to_regression_table(
10721128
total_stable,
10731129
total_unstable,
10741130
total_comparison_points,
1131+
regressions_list,
1132+
improvements_list,
10751133
)
10761134

10771135

utils/tests/test_builder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ def test_get_branch_version_from_test_details():
154154

155155
def test_cli_build():
156156
try:
157-
# if should_run_builder():
158-
if True:
159-
157+
if should_run_builder():
160158
db_port = int(os.getenv("DATASINK_PORT", "6379"))
161159
conn = redis.StrictRedis(port=db_port)
162160
conn.ping()

0 commit comments

Comments
 (0)