From 1fe3116ce5f2cb70c72a14cf49916cc75fd1f913 Mon Sep 17 00:00:00 2001 From: fcosta_oliveira Date: Mon, 29 Jul 2024 22:58:01 +0300 Subject: [PATCH 1/2] Fixed coordinator filtering based uppon test regexp --- .../self_contained_coordinator.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py index a937e856..64ae9ebc 100644 --- a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py +++ b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py @@ -530,11 +530,11 @@ def process_self_contained_coordinator_stream( fn, github_token, pull_request, "redis", "redis", verbose ) - test_regexp = ".*" - if b"test_regexp" in testDetails: - test_regexp = testDetails[b"test_regexp"] + tests_regexp = ".*" + if b"tests_regexp" in testDetails: + tests_regexp = testDetails[b"tests_regexp"] logging.info( - f"detected a regexp definition on the streamdata {test_regexp}" + f"detected a regexp definition on the streamdata {tests_regexp}" ) command_groups_regexp = None @@ -596,7 +596,7 @@ def process_self_contained_coordinator_stream( defaults_filename, priority_lower_limit, priority_upper_limit, - test_regexp, + tests_regexp, testsuite_spec_files, command_groups_regexp, ) @@ -1368,7 +1368,7 @@ def filter_test_files( defaults_filename, priority_lower_limit, priority_upper_limit, - test_regexp, + tests_regexp, testsuite_spec_files, command_groups_regexp=None, ): @@ -1377,17 +1377,17 @@ def filter_test_files( if defaults_filename in test_file: continue - if test_regexp != ".*": + if tests_regexp != ".*": logging.info( - "Filtering all tests via a regular expression: {}".format(test_regexp) + "Filtering all tests via a regular expression: {}".format(tests_regexp) ) - tags_regex_string = re.compile(test_regexp) + tags_regex_string = re.compile(tests_regexp) match_obj = re.search(tags_regex_string, test_file) if match_obj is None: logging.info( "Skipping {} given it does not match regex {}".format( - test_file, test_regexp + test_file, tests_regexp ) ) continue From cfc3278afce588b060406023f93f37411643e2b4 Mon Sep 17 00:00:00 2001 From: fcosta_oliveira Date: Tue, 30 Jul 2024 12:38:14 +0300 Subject: [PATCH 2/2] Fixed git_timestamp_ms usage on cli triggering (for historical/past data filling) --- pyproject.toml | 2 +- redis_benchmarks_specification/__cli__/cli.py | 19 ++++++++++++++++--- .../__common__/builder_schema.py | 3 ++- .../self_contained_coordinator.py | 2 +- .../__spec__/cli.py | 14 +++++++------- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d1a41daa..048e25bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "redis-benchmarks-specification" -version = "0.1.205" +version = "0.1.207" 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 ","Redis Performance Group "] readme = "Readme.md" diff --git a/redis_benchmarks_specification/__cli__/cli.py b/redis_benchmarks_specification/__cli__/cli.py index 62b41a52..2fcb79f1 100644 --- a/redis_benchmarks_specification/__cli__/cli.py +++ b/redis_benchmarks_specification/__cli__/cli.py @@ -73,6 +73,10 @@ def get_commits_by_branch(args, repo): commits = [] for commit in repo.iter_commits(): commit_datetime = commit.committed_datetime + git_timestamp_ms = int( + datetime.datetime.utcfromtimestamp(commit_datetime.timestamp()).timestamp() + * 1000 + ) if ( args.from_date <= datetime.datetime.utcfromtimestamp(commit_datetime.timestamp()) @@ -87,6 +91,7 @@ def get_commits_by_branch(args, repo): "git_branch": repo.active_branch.name, "commit_summary": commit.summary, "commit_datetime": str(commit_datetime), + "git_timestamp_ms": git_timestamp_ms, } ) return commits, total_commits @@ -107,6 +112,14 @@ def get_commits_by_tags(args, repo): tags = sorted(repo.tags, key=lambda t: t.commit.committed_datetime) for tag in tags: + + git_timestamp_ms = int( + datetime.datetime.utcfromtimestamp( + tag.commit.committed_datetime.timestamp() + ).timestamp() + * 1000 + ) + if ( args.from_date <= datetime.datetime.utcfromtimestamp( @@ -137,6 +150,7 @@ def get_commits_by_tags(args, repo): "git_version": git_version, "commit_summary": tag.commit.summary, "commit_datetime": commit_datetime, + "git_timestamp_ms": git_timestamp_ms, } ) except packaging.version.InvalidVersion: @@ -265,6 +279,7 @@ def trigger_tests_cli_command_logic(args, project_name, project_version): for cdict in commits: commit_hash = cdict["git_hash"] commit_summary = cdict["commit_summary"] + commit_datetime = cdict["commit_datetime"] match_obj = re.search(hash_regexp_string, commit_hash) if match_obj is None: logging.info( @@ -274,9 +289,7 @@ def trigger_tests_cli_command_logic(args, project_name, project_version): ) else: print( - "Commit with hash: {} added. summary: {}".format( - commit_hash, commit_summary - ) + f"Commit with hash: {commit_hash} from {commit_datetime} added. summary: {commit_summary}" ) filtered_hash_commits.append(cdict) diff --git a/redis_benchmarks_specification/__common__/builder_schema.py b/redis_benchmarks_specification/__common__/builder_schema.py index d02a008a..0f2fcd02 100644 --- a/redis_benchmarks_specification/__common__/builder_schema.py +++ b/redis_benchmarks_specification/__common__/builder_schema.py @@ -107,7 +107,8 @@ def get_commit_dict_from_sha( commit.commit.author.date.timestamp() * 1000.0 ) else: - use_git_timestamp = False + if "git_timestamp_ms" not in commit_dict: + use_git_timestamp = False commit_dict["use_git_timestamp"] = str(use_git_timestamp) commit_dict["git_hash"] = git_hash if gh_branch is not None: diff --git a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py index 64ae9ebc..19c8f9c7 100644 --- a/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py +++ b/redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py @@ -532,7 +532,7 @@ def process_self_contained_coordinator_stream( tests_regexp = ".*" if b"tests_regexp" in testDetails: - tests_regexp = testDetails[b"tests_regexp"] + tests_regexp = testDetails[b"tests_regexp"].decode() logging.info( f"detected a regexp definition on the streamdata {tests_regexp}" ) diff --git a/redis_benchmarks_specification/__spec__/cli.py b/redis_benchmarks_specification/__spec__/cli.py index 96c0ebee..b661d38b 100644 --- a/redis_benchmarks_specification/__spec__/cli.py +++ b/redis_benchmarks_specification/__spec__/cli.py @@ -92,13 +92,12 @@ def cli_command_logic(args, project_name, project_version): total_commits = 0 if args.use_branch: for commit in repo.iter_commits(): - if ( - args.from_date - <= datetime.datetime.utcfromtimestamp( - commit.committed_datetime.timestamp() - ) - <= args.to_date - ): + + commit_datetime_utc = datetime.datetime.utcfromtimestamp( + commit.committed_datetime.timestamp() + ) + git_timestamp_ms = int(commit_datetime_utc.timestamp() * 1000) + if args.from_date <= commit_datetime_utc <= args.to_date: if ( args.last_n > 0 and total_commits < args.last_n ) or args.last_n == -1: @@ -109,6 +108,7 @@ def cli_command_logic(args, project_name, project_version): "git_hash": commit.hexsha, "git_branch": repo.active_branch.name, "commit_summary": commit.summary, + "git_timestamp_ms": git_timestamp_ms, } ) if args.use_tags: