Skip to content

Commit

Permalink
Enabled running forks source built benchmarks (#264)
Browse files Browse the repository at this point in the history
* Enabled running forks source built benchmarks

* Fixed server_name Null check
  • Loading branch information
fcostaoliveira authored Aug 20, 2024
1 parent e9b242f commit 7678cea
Show file tree
Hide file tree
Showing 9 changed files with 549 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "redis-benchmarks-specification"
version = "0.1.216"
version = "0.1.217"
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."
authors = ["filipecosta90 <[email protected]>","Redis Performance Group <[email protected]>"]
readme = "Readme.md"
Expand Down
35 changes: 35 additions & 0 deletions redis_benchmarks_specification/__builder__/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def builder_process_stream(
if b"git_hash" in testDetails:
git_hash = testDetails[b"git_hash"]
logging.info("Received commit hash specifier {}.".format(git_hash))
logging.info(f"Received the following build stream: {testDetails}.")
binary_zip_key = testDetails[b"zip_archive_key"]
logging.info(
"Retriving zipped source from key {}.".format(
Expand Down Expand Up @@ -271,6 +272,16 @@ def builder_process_stream(
if b"tests_groups_regexp" in testDetails:
tests_groups_regexp = testDetails[b"tests_groups_regexp"].decode()

github_org = "redis"
if b"github_org" in testDetails:
github_org = testDetails[b"github_org"].decode()
logging.info(f"detected github_org info on build stream {github_org}")

github_repo = "redis"
if b"github_repo" in testDetails:
github_repo = testDetails[b"github_repo"].decode()
logging.info(f"detected github_repo info on build stream {github_repo}")

# github updates
is_actionable_pr = False
contains_regression_comment = False
Expand Down Expand Up @@ -321,6 +332,14 @@ def builder_process_stream(
build_artifacts = ["redis-server"]
if "build_artifacts" in build_config:
build_artifacts = build_config["build_artifacts"]
if b"build_artifacts" in testDetails:
new_build_artifacts = (
testDetails[b"build_artifacts"].decode().split(",")
)
logging.info(
f"overriding default build artifacts {build_artifacts} by {new_build_artifacts}"
)
build_artifacts = new_build_artifacts
build_vars_str = ""
if "env" in build_config:
if build_config["env"] is not None:
Expand Down Expand Up @@ -361,6 +380,12 @@ def builder_process_stream(
"redis-server",
build_vars_str,
)
if b"build_command" in testDetails:
build_command = testDetails[b"build_command"].decode()
server_name = "redis"
if b"server_name" in testDetails:
server_name = testDetails[b"server_name"].decode()

build_start_datetime = datetime.datetime.utcnow()
logging.info(
"Using the following build command {}.".format(build_command)
Expand Down Expand Up @@ -435,6 +460,9 @@ def builder_process_stream(
tests_priority_upper_limit,
tests_regexp,
use_git_timestamp,
server_name,
github_org,
github_repo,
)
if result is True:
benchmark_stream_id = conn.xadd(
Expand Down Expand Up @@ -572,6 +600,9 @@ def generate_benchmark_stream_request(
tests_priority_upper_limit=10000,
tests_regexp=".*",
use_git_timestamp=False,
server_name="redis",
github_org="redis",
github_repo="redis",
):
build_stream_fields = {
"id": id,
Expand All @@ -584,6 +615,9 @@ def generate_benchmark_stream_request(
"tests_priority_upper_limit": tests_priority_upper_limit,
"tests_priority_lower_limit": tests_priority_lower_limit,
"tests_groups_regexp": tests_groups_regexp,
"server_name": server_name,
"github_org": github_org,
"github_repo": github_repo,
}
if build_config_metadata is not None:
build_stream_fields["metadata"] = json.dumps(build_config_metadata)
Expand All @@ -594,6 +628,7 @@ def generate_benchmark_stream_request(
if build_vars_str is not None:
build_stream_fields["build_vars"] = build_vars_str
if build_command is not None:
logging.info(f"adding build_command: {build_command}")
build_stream_fields["build_command"] = build_command
if build_image is not None:
build_stream_fields["build_image"] = build_image
Expand Down
15 changes: 15 additions & 0 deletions redis_benchmarks_specification/__cli__/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ def spec_cli_args(parser):
action="store_true",
help="Iterate over the git commits.",
)
parser.add_argument(
"--build_artifacts",
type=str,
default="",
)
parser.add_argument(
"--build_command",
type=str,
default="",
)
parser.add_argument(
"--git_hash",
type=str,
default="",
)
parser.add_argument(
"--dry-run",
default=False,
Expand Down
16 changes: 16 additions & 0 deletions redis_benchmarks_specification/__cli__/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
filtered_hash_commits = []
for cdict in commits:
commit_hash = cdict["git_hash"]
if args.git_hash != "":
if args.git_hash != commit_hash:
logging.info(
"Skipping {} given it does not match commit hash {}".format(
commit_hash, args.git_hash
)
)
continue
commit_summary = cdict["commit_summary"]
commit_datetime = cdict["commit_datetime"]
match_obj = re.search(hash_regexp_string, commit_hash)
Expand Down Expand Up @@ -412,6 +420,14 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
commit_dict["tests_priority_lower_limit"] = tests_priority_lower_limit
commit_dict["tests_regexp"] = tests_regexp
commit_dict["tests_groups_regexp"] = tests_groups_regexp
commit_dict["github_org"] = args.gh_org
commit_dict["github_repo"] = args.gh_repo
if args.server_name is not None and args.server_name != "":
commit_dict["server_name"] = args.server_name
if args.build_artifacts != "":
commit_dict["build_artifacts"] = args.build_artifacts
if args.build_command != "":
commit_dict["build_command"] = args.build_command
if pull_request is not None:
logging.info(
f"Have a pull request info to include in build request {pull_request}"
Expand Down
2 changes: 1 addition & 1 deletion redis_benchmarks_specification/__common__/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def exporter_datasink_common(
git_hash=None,
):
logging.info(
f"Using datapoint_time_ms: {datapoint_time_ms}. git_has={git_hash}, git_branch={git_branch}, git_version={git_version}"
f"Using datapoint_time_ms: {datapoint_time_ms}. git_hash={git_hash}, git_branch={git_branch}, git_version={git_version}. gh_org={tf_github_org}, gh_repo={tf_github_repo}"
)
timeseries_test_sucess_flow(
datasink_push_results_redistimeseries,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ def process_self_contained_coordinator_stream(
logging.info(
f"detected a server_name definition on the streamdata: {server_name}."
)
new_executable = f"{mnt_point}{server_name}-server"
logging.info(
"changing executable from {executable} to {new_executable}"
)
executable = new_executable

if b"restore_build_artifacts" in testDetails:
restore_build_artifacts = bool(
Expand Down
Loading

0 comments on commit 7678cea

Please sign in to comment.