Skip to content

Commit d9bb164

Browse files
Enabled to specify redis_proc_start_port on self contained coordinator; Include merge-base commit tests on API trigger (#106)
* Enabled to specify redis_proc_start_port on self contained coordinator * Fixed flake8 check on port/redis_proc_start_port * Updated redisbench-admin to 0.8.10 * Bumped redisbench-admin deps. Fixed failing tests after upgrade of deps/spec
1 parent 9bd0473 commit d9bb164

File tree

8 files changed

+75
-123
lines changed

8 files changed

+75
-123
lines changed

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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(

redis_benchmarks_specification/__self_contained_coordinator__/args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def create_self_contained_coordinator_args(project_name):
3636
default=MACHINE_CPU_COUNT,
3737
help="Specify how much of the available CPU resources the coordinator can use.",
3838
)
39+
parser.add_argument("--redis_proc_start_port", type=int, default=6379)
3940
parser.add_argument("--cpuset_start_pos", type=int, default=0)
4041
parser.add_argument(
4142
"--platform-name",

0 commit comments

Comments
 (0)