Skip to content

Commit cfc3278

Browse files
Fixed git_timestamp_ms usage on cli triggering (for historical/past data filling)
1 parent 89826e2 commit cfc3278

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
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.205"
3+
version = "0.1.207"
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/__cli__/cli.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ def get_commits_by_branch(args, repo):
7373
commits = []
7474
for commit in repo.iter_commits():
7575
commit_datetime = commit.committed_datetime
76+
git_timestamp_ms = int(
77+
datetime.datetime.utcfromtimestamp(commit_datetime.timestamp()).timestamp()
78+
* 1000
79+
)
7680
if (
7781
args.from_date
7882
<= datetime.datetime.utcfromtimestamp(commit_datetime.timestamp())
@@ -87,6 +91,7 @@ def get_commits_by_branch(args, repo):
8791
"git_branch": repo.active_branch.name,
8892
"commit_summary": commit.summary,
8993
"commit_datetime": str(commit_datetime),
94+
"git_timestamp_ms": git_timestamp_ms,
9095
}
9196
)
9297
return commits, total_commits
@@ -107,6 +112,14 @@ def get_commits_by_tags(args, repo):
107112

108113
tags = sorted(repo.tags, key=lambda t: t.commit.committed_datetime)
109114
for tag in tags:
115+
116+
git_timestamp_ms = int(
117+
datetime.datetime.utcfromtimestamp(
118+
tag.commit.committed_datetime.timestamp()
119+
).timestamp()
120+
* 1000
121+
)
122+
110123
if (
111124
args.from_date
112125
<= datetime.datetime.utcfromtimestamp(
@@ -137,6 +150,7 @@ def get_commits_by_tags(args, repo):
137150
"git_version": git_version,
138151
"commit_summary": tag.commit.summary,
139152
"commit_datetime": commit_datetime,
153+
"git_timestamp_ms": git_timestamp_ms,
140154
}
141155
)
142156
except packaging.version.InvalidVersion:
@@ -265,6 +279,7 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
265279
for cdict in commits:
266280
commit_hash = cdict["git_hash"]
267281
commit_summary = cdict["commit_summary"]
282+
commit_datetime = cdict["commit_datetime"]
268283
match_obj = re.search(hash_regexp_string, commit_hash)
269284
if match_obj is None:
270285
logging.info(
@@ -274,9 +289,7 @@ def trigger_tests_cli_command_logic(args, project_name, project_version):
274289
)
275290
else:
276291
print(
277-
"Commit with hash: {} added. summary: {}".format(
278-
commit_hash, commit_summary
279-
)
292+
f"Commit with hash: {commit_hash} from {commit_datetime} added. summary: {commit_summary}"
280293
)
281294
filtered_hash_commits.append(cdict)
282295

redis_benchmarks_specification/__common__/builder_schema.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def get_commit_dict_from_sha(
107107
commit.commit.author.date.timestamp() * 1000.0
108108
)
109109
else:
110-
use_git_timestamp = False
110+
if "git_timestamp_ms" not in commit_dict:
111+
use_git_timestamp = False
111112
commit_dict["use_git_timestamp"] = str(use_git_timestamp)
112113
commit_dict["git_hash"] = git_hash
113114
if gh_branch is not None:

redis_benchmarks_specification/__self_contained_coordinator__/self_contained_coordinator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def process_self_contained_coordinator_stream(
532532

533533
tests_regexp = ".*"
534534
if b"tests_regexp" in testDetails:
535-
tests_regexp = testDetails[b"tests_regexp"]
535+
tests_regexp = testDetails[b"tests_regexp"].decode()
536536
logging.info(
537537
f"detected a regexp definition on the streamdata {tests_regexp}"
538538
)

redis_benchmarks_specification/__spec__/cli.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ def cli_command_logic(args, project_name, project_version):
9292
total_commits = 0
9393
if args.use_branch:
9494
for commit in repo.iter_commits():
95-
if (
96-
args.from_date
97-
<= datetime.datetime.utcfromtimestamp(
98-
commit.committed_datetime.timestamp()
99-
)
100-
<= args.to_date
101-
):
95+
96+
commit_datetime_utc = datetime.datetime.utcfromtimestamp(
97+
commit.committed_datetime.timestamp()
98+
)
99+
git_timestamp_ms = int(commit_datetime_utc.timestamp() * 1000)
100+
if args.from_date <= commit_datetime_utc <= args.to_date:
102101
if (
103102
args.last_n > 0 and total_commits < args.last_n
104103
) or args.last_n == -1:
@@ -109,6 +108,7 @@ def cli_command_logic(args, project_name, project_version):
109108
"git_hash": commit.hexsha,
110109
"git_branch": repo.active_branch.name,
111110
"commit_summary": commit.summary,
111+
"git_timestamp_ms": git_timestamp_ms,
112112
}
113113
)
114114
if args.use_tags:

0 commit comments

Comments
 (0)