Skip to content

Commit 37667c9

Browse files
committed
Sync with main
2 parents a5c08cb + 0e438ff commit 37667c9

27 files changed

+157
-155
lines changed

Readme.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,46 @@ redis-benchmarks-spec-sc-coordinator RUNNING pid 27842, uptime 0:00:00
323323
```
324324

325325

326+
## Development
327+
328+
1. Install [pypoetry](https://python-poetry.org/) to manage your dependencies and trigger tooling.
329+
```sh
330+
pip install poetry
331+
```
332+
333+
2. Installing dependencies from lock file
334+
335+
```
336+
poetry install
337+
```
338+
339+
### Running formaters
340+
341+
```sh
342+
poetry run black .
343+
```
344+
345+
346+
### Running linters
347+
348+
```sh
349+
poetry run flake8
350+
```
351+
352+
353+
### Running tests
354+
355+
A test suite is provided, and can be run with:
356+
357+
```sh
358+
$ tox
359+
```
360+
361+
To run a specific test:
362+
```sh
363+
$ tox -- utils/tests/test_runner.py
364+
```
365+
326366
## License
327367

328-
redis-benchmark-specifications is distributed under the Apache 2 license - see [LICENSE](LICENSE)
368+
redisbench-admin is distributed under the BSD3 license - see [LICENSE](LICENSE)

poetry.lock

Lines changed: 8 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redis-benchmarks-specification"
3-
version = "0.1.30"
3+
version = "0.1.35"
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"
@@ -16,7 +16,7 @@ argparse = "^1.4.0"
1616
Flask-HTTPAuth = "^4.4.0"
1717
PyYAML = "^5.4.1"
1818
docker = "^5.0.0"
19-
redisbench-admin = "^0.8.6"
19+
redisbench-admin = "^0.9.3"
2020
#redisbench-admin = {path = "../redisbench-admin", develop = true}
2121
psutil = "^5.8.0"
2222
tox-docker = "^3.1.0"

redis_benchmarks_specification/__api__/app.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
SIG_HEADER = "X-Hub-Signature"
1515

1616

17+
def should_action(action):
18+
res = False
19+
types = ["synchronize", "opened", "reopened", "labeled"]
20+
for tt in types:
21+
if action in tt:
22+
res = True
23+
return res
24+
25+
1726
def create_app(conn, user, test_config=None):
1827
app = Flask(__name__)
1928

@@ -63,7 +72,7 @@ def base():
6372
trigger_label = PULL_REQUEST_TRIGGER_LABEL
6473
if "pull_request" in request_data:
6574
action = request_data["action"]
66-
if "labeled" == action:
75+
if should_action(action):
6776
pull_request_dict = request_data["pull_request"]
6877
head_dict = pull_request_dict["head"]
6978
repo_dict = head_dict["repo"]
@@ -93,6 +102,7 @@ def base():
93102
)
94103

95104
# Git pushes to repo
105+
before_sha = None
96106
if "ref" in request_data:
97107
repo_dict = request_data["repository"]
98108
html_url = repo_dict["html_url"].split("/")
@@ -101,11 +111,33 @@ def base():
101111
ref = request_data["ref"].split("/")[-1]
102112
ref_label = request_data["ref"]
103113
sha = request_data["after"]
114+
before_sha = request_data["before"]
104115
use_event = True
105116
event_type = "Git pushes to repo"
106117

107118
if use_event is True:
108-
fields = {
119+
if before_sha is not None:
120+
fields_before = {
121+
"git_hash": sha,
122+
"ref_label": ref_label,
123+
"ref": ref,
124+
"gh_repo": gh_repo,
125+
"gh_org": gh_org,
126+
}
127+
app.logger.info(
128+
"Using event {} to trigger merge-base commit benchmark. final fields: {}".format(
129+
event_type, fields_before
130+
)
131+
)
132+
result, response_data, err_message = commit_schema_to_stream(
133+
fields_before, conn, gh_org, gh_repo
134+
)
135+
app.logger.info(
136+
"Using event {} to trigger merge-base commit benchmark. final fields: {}".format(
137+
event_type, response_data
138+
)
139+
)
140+
fields_after = {
109141
"git_hash": sha,
110142
"ref_label": ref_label,
111143
"ref": ref,
@@ -114,11 +146,11 @@ def base():
114146
}
115147
app.logger.info(
116148
"Using event {} to trigger benchmark. final fields: {}".format(
117-
event_type, fields
149+
event_type, fields_after
118150
)
119151
)
120152
result, response_data, err_message = commit_schema_to_stream(
121-
fields, conn, gh_org, gh_repo
153+
fields_after, conn, gh_org, gh_repo
122154
)
123155
app.logger.info(
124156
"Using event {} to trigger benchmark. final fields: {}".format(

0 commit comments

Comments
 (0)