This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 885e050b6b MINOR: [Go][CI][Benchmarking] Fix GitHub info in Go 
benchmarks (#14952)
885e050b6b is described below

commit 885e050b6b2c367d266793cba8d601c805a4e17d
Author: Austin Dickey <[email protected]>
AuthorDate: Wed Dec 14 16:15:49 2022 -0600

    MINOR: [Go][CI][Benchmarking] Fix GitHub info in Go benchmarks (#14952)
    
    This PR changes `go_bench_adapt.py` to be more accurate about reporting 
GitHub information to Conbench from a local computer.
    
    In most cases, this script will be run on the master branch during [this 
workflow](https://github.com/apache/arrow/blob/794aefd6409a3da339ecc1a3d1ea6466b3d9ddb6/.github/workflows/go.yml#L94).
 This PR shouldn't change that use case.
    
    However, rarely, someone might [run benchmarks 
locally](https://conbench.ursa.dev/?search=branch) on a branch on their 
computer. If that's the case, we want the GitHub information to be scraped from 
the local repo, instead of assuming it's on the master branch. This is 
accomplished by passing `None` to `github`.
    
    Authored-by: Austin Dickey <[email protected]>
    Signed-off-by: Matt Topol <[email protected]>
---
 ci/scripts/go_bench_adapt.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/ci/scripts/go_bench_adapt.py b/ci/scripts/go_bench_adapt.py
index 31ec093ba0..a0f4a1dc19 100644
--- a/ci/scripts/go_bench_adapt.py
+++ b/ci/scripts/go_bench_adapt.py
@@ -30,7 +30,17 @@ log.setLevel(logging.DEBUG)
 
 ARROW_ROOT = Path(__file__).parent.parent.parent.resolve()
 SCRIPTS_PATH = ARROW_ROOT / "ci" / "scripts"
-RUN_REASON = "commit" if os.environ.get("CONBENCH_REF") == "master" else 
"branch"
+
+if os.environ.get("CONBENCH_REF") == "master":
+    github = {
+        "repository": os.environ["GITHUB_REPOSITORY"],
+        "commit": os.environ["GITHUB_SHA"],
+        "pr_number": None,  # implying default branch
+    }
+    run_reason = "commit"
+else:
+    github = None  # scrape github info from the local repo
+    run_reason = "branch"
 
 class GoAdapter(BenchmarkAdapter):
     result_file = "bench_stats.json"
@@ -78,12 +88,8 @@ class GoAdapter(BenchmarkAdapter):
                         "name": pieces[0],
                         "params": '/'.join(pieces[1:]),
                     },
-                    run_reason=RUN_REASON,
-                    github={
-                        "repository": os.environ["GITHUB_REPOSITORY"],
-                        "commit": os.environ["GITHUB_SHA"],
-                        "pr_number": None,  # we currently only run this on 
the default branch
-                    },
+                    run_reason=run_reason,
+                    github=github,
                 )
                 parsed.run_name = f"{parsed.run_reason}: 
{parsed.github['commit']}"
                 parsed_results.append(parsed)

Reply via email to