Skip to content

Commit

Permalink
add pr_id in case the pr title is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahAhianyo committed Mar 20, 2024
1 parent 5faa517 commit 11aa13d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Expand Up @@ -123,4 +123,4 @@ jobs:
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--benchmark-json "${{ env.OUTPUT_FILE }}" --pr-title "${{ github.event.pull_request.title }}"
--db-url "${{ env.DATABASE_URL }}" --branch-name "${{ github.head_ref || github.ref_name }}"
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}"
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}" --pr-id "${{ github.event.pull_request.id }}"
13 changes: 11 additions & 2 deletions scripts/simple_app_benchmark_upload.py
Expand Up @@ -59,6 +59,7 @@ def insert_benchmarking_data(
branch_name: str,
event_type: str,
actor: str,
pr_id: str,
):
"""Insert the benchmarking data into the database.
Expand All @@ -72,6 +73,7 @@ def insert_benchmarking_data(
branch_name: The name of the branch.
event_type: Type of github event(push, pull request, etc)
actor: Username of the user that triggered the run.
pr_id: Id of the PR.
"""
# Serialize the JSON data
simple_app_performance_json = json.dumps(performance_data)
Expand All @@ -82,8 +84,8 @@ def insert_benchmarking_data(
# Connect to the database and insert the data
with psycopg2.connect(db_connection_url) as conn, conn.cursor() as cursor:
insert_query = """
INSERT INTO simple_app_benchmarks (os, python_version, commit_sha, time, pr_title, branch_name, event_type, actor, performance)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s);
INSERT INTO simple_app_benchmarks (os, python_version, commit_sha, time, pr_title, branch_name, event_type, actor, performance, pr_id)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
"""
cursor.execute(
insert_query,
Expand All @@ -97,6 +99,7 @@ def insert_benchmarking_data(
event_type,
actor,
simple_app_performance_json,
pr_id
),
)
# Commit the transaction
Expand Down Expand Up @@ -145,6 +148,11 @@ def main():
help="Username of the user that triggered the run.",
required=True,
)
parser.add_argument(
"--pr-id",
help="ID of the PR.",
required=True,
)
args = parser.parse_args()

# Get the results of pytest benchmarks
Expand All @@ -160,6 +168,7 @@ def main():
branch_name=args.branch_name,
event_type=args.event_type,
actor=args.actor,
pr_id=args.pr_id
)


Expand Down

0 comments on commit 11aa13d

Please sign in to comment.