Skip to content

Commit cd893a2

Browse files
benchmark coordinator is accepting benchmark group filters
1 parent 20e30ef commit cd893a2

File tree

6 files changed

+65
-19
lines changed

6 files changed

+65
-19
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.1.101"
3+
version = "0.1.205"
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 <filipecosta.90@gmail.com>","Redis Performance Group <performance@redis.com>"]
66
readme = "Readme.md"

redis_benchmarks_specification/__builder__/builder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ def builder_process_stream(
245245
use_git_timestamp = False
246246
commit_datetime = "n/a"
247247
if b"commit_datetime" in testDetails:
248-
commit_datetime = int(testDetails[b"commit_datetime"].decode())
248+
commit_datetime = testDetails[b"commit_datetime"].decode()
249249
commit_summary = "n/a"
250250
if b"commit_summary" in testDetails:
251-
commit_summary = int(testDetails[b"commit_summary"].decode())
251+
commit_summary = testDetails[b"commit_summary"].decode()
252252
git_branch, git_version = get_branch_version_from_test_details(testDetails)
253253
if b"use_git_timestamp" in testDetails:
254254
use_git_timestamp = bool(testDetails[b"use_git_timestamp"])

redis_benchmarks_specification/__cli__/args.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from redisbench_admin.run.common import get_start_time_vars
1919

2020
START_TIME_NOW_UTC, _, _ = get_start_time_vars()
21-
START_TIME_LAST_YEAR_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=7)
21+
START_TIME_LAST_YEAR_UTC = START_TIME_NOW_UTC - datetime.timedelta(days=90)
2222
CLI_TOOL_STATS = "stats"
2323
CLI_TOOL_TRIGGER = "trigger"
2424
PERFORMANCE_GH_TOKEN = os.getenv("PERFORMANCE_GH_TOKEN", None)
@@ -163,8 +163,8 @@ def spec_cli_args(parser):
163163
parser.add_argument(
164164
"--last_n",
165165
type=int,
166-
default=-1,
167-
help="Use the last N samples. by default will use all available values",
166+
default=1,
167+
help="Use the last N samples. by default will use last commit",
168168
)
169169
parser.add_argument(
170170
"--platform",

redis_benchmarks_specification/__cli__/cli.py

+5
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
322322
commit_dict["tests_priority_lower_limit"] = tests_priority_lower_limit
323323
commit_dict["tests_regexp"] = tests_regexp
324324
commit_dict["tests_groups_regexp"] = tests_groups_regexp
325+
if pull_request is not None:
326+
logging.info(
327+
f"Have a pull request info to include in build request {pull_request}"
328+
)
329+
commit_dict["pull_request"] = pull_request
325330
git_hash = cdict["git_hash"]
326331
git_branch = "n/a"
327332
if "git_branch" in cdict:

redis_benchmarks_specification/__common__/github.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def check_github_available_and_actionable(
104104
regression_comment = None
105105
github_pr = None
106106
old_regression_comment_body = ""
107+
pr_link = None
107108
if github_token is not None:
108109
logging.info("Detected github token")
109110
g = Github(github_token)
@@ -134,9 +135,10 @@ def check_github_available_and_actionable(
134135
print("".join(["-" for x in range(1, 80)]))
135136
else:
136137
logging.info("Does not contain PR comment")
137-
logging.info(
138-
f"contains_regression_comment: {contains_regression_comment}, is_actionable_pr: {is_actionable_pr}, pr_link: {pr_link}"
139-
)
138+
logging.info(
139+
f"contains_regression_comment: {contains_regression_comment}, is_actionable_pr: {is_actionable_pr}, pr_link: {pr_link}"
140+
)
141+
140142
return (
141143
contains_regression_comment,
142144
github_pr,
@@ -226,7 +228,9 @@ def check_benchmark_running_comment(comments):
226228

227229

228230
def markdown_progress_bar(current, total, bar_length=40):
229-
progress = current / total
231+
progress = 1.0
232+
if total > 0:
233+
progress = current / total
230234
block = int(round(bar_length * progress))
231235
bar = "#" * block + "-" * (bar_length - block)
232236
percentage = round(progress * 100, 2)

redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py

+46-9
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,13 @@ def process_self_contained_coordinator_stream(
537537
f"detected a regexp definition on the streamdata {test_regexp}"
538538
)
539539

540+
command_groups_regexp = None
541+
if b"tests_groups_regexp" in testDetails:
542+
command_groups_regexp = testDetails[b"tests_groups_regexp"].decode()
543+
logging.info(
544+
f"detected a command groups regexp definition on the streamdata {command_groups_regexp}"
545+
)
546+
540547
skip_test = False
541548
if b"platform" in testDetails:
542549
platform = testDetails[b"platform"]
@@ -591,6 +598,7 @@ def process_self_contained_coordinator_stream(
591598
priority_upper_limit,
592599
test_regexp,
593600
testsuite_spec_files,
601+
command_groups_regexp,
594602
)
595603

596604
for test_file in filtered_test_files:
@@ -611,16 +619,16 @@ def process_self_contained_coordinator_stream(
611619
pending_tests = len(filtered_test_files)
612620
failed_tests = 0
613621
benchmark_suite_start_datetime = datetime.datetime.utcnow()
614-
comment_body = generate_benchmark_started_pr_comment(
615-
stream_id,
616-
pending_tests,
617-
len(filtered_test_files),
618-
failed_tests,
619-
benchmark_suite_start_datetime,
620-
0,
621-
)
622622
# update on github if needed
623623
if is_actionable_pr:
624+
comment_body = generate_benchmark_started_pr_comment(
625+
stream_id,
626+
pending_tests,
627+
len(filtered_test_files),
628+
failed_tests,
629+
benchmark_suite_start_datetime,
630+
0,
631+
)
624632
if contains_benchmark_run_comment:
625633
update_comment_if_needed(
626634
auto_approve_github,
@@ -1261,7 +1269,7 @@ def process_self_contained_coordinator_stream(
12611269
to_date = datetime.datetime.utcnow()
12621270
from_date = to_date - datetime.timedelta(days=180)
12631271
baseline_branch = default_baseline_branch
1264-
comparison_tag = git_tag
1272+
comparison_tag = git_version
12651273
comparison_branch = git_branch
12661274
to_ts_ms = None
12671275
from_ts_ms = None
@@ -1362,6 +1370,7 @@ def filter_test_files(
13621370
priority_upper_limit,
13631371
test_regexp,
13641372
testsuite_spec_files,
1373+
command_groups_regexp=None,
13651374
):
13661375
filtered_test_files = []
13671376
for test_file in testsuite_spec_files:
@@ -1397,6 +1406,34 @@ def filter_test_files(
13971406
)
13981407
continue
13991408

1409+
if command_groups_regexp is not None:
1410+
logging.info(
1411+
"Filtering all test command groups via a regular expression: {}".format(
1412+
command_groups_regexp
1413+
)
1414+
)
1415+
if "tested-groups" in benchmark_config:
1416+
command_groups = benchmark_config["tested-groups"]
1417+
logging.info(
1418+
f"The file {test_file} (test name = {test_name}) contains the following groups: {command_groups}"
1419+
)
1420+
groups_regex_string = re.compile(command_groups_regexp)
1421+
found = False
1422+
for command_group in command_groups:
1423+
match_obj = re.search(groups_regex_string, command_group)
1424+
if match_obj is not None:
1425+
found = True
1426+
logging.info(f"found the command group {command_group}")
1427+
if found is False:
1428+
logging.info(
1429+
f"Skipping {test_file} given the following groups: {command_groups} does not match command group regex {command_groups_regexp}"
1430+
)
1431+
continue
1432+
else:
1433+
logging.warning(
1434+
f"The file {test_file} (test name = {test_name}) does not contain the property 'tested-groups'. Cannot filter based uppon groups..."
1435+
)
1436+
14001437
if "priority" in benchmark_config:
14011438
priority = benchmark_config["priority"]
14021439

0 commit comments

Comments
 (0)