jgehrcke opened a new pull request, #35467:
URL: https://github.com/apache/arrow/pull/35467

   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's 
Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing 
Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor 
PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). 
Could you open an issue for this pull request on GitHub? 
https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the 
[Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.)
 of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   As part of https://github.com/apache/arrow/issues/31142 we did not rename 
`master` to `main` in 
[`ci/scripts/go_bench_adapt.py`](https://github.com/apache/arrow/blob/b43f4cd4ce28e2ddb7bad89081e141f381b09d5e/ci/scripts/go_bench_adapt.py#L34).
   
   This was not immediately noticed in CI because we accidentally switched to a 
code branch intended for local dev (cf. the `else:` block 
[here](https://github.com/apache/arrow/blob/b43f4cd4ce28e2ddb7bad89081e141f381b09d5e/ci/scripts/go_bench_adapt.py#L41)).
   
   Since then we were unintentionally using a feature in conbench/benchadapt to 
read commit information from the local file system, instead of reading it from 
CI-focused environment variables.
   
   That even worked for a while.
   
   However, last week, that feature was [removed from 
benchadapt](https://github.com/conbench/conbench/pull/1135#issuecomment-1537110851)
 (certainly assuming that this is _not_ used in CI anywhere).
   
   That is also when `BenchmarkResult.github` started to potentially become 
`None`. Which `mypy` knows about, see:
   
![image](https://user-images.githubusercontent.com/265630/236622341-0dee8385-d58b-4784-ab1e-233f4d471352.png)
   
   Well, but further down in code, `parsed.github['commit']` was used w/o 
protection against this `None` case, and that is how we started to see CI run 
failures with
   ```
   Traceback (most recent call last):
   ...
     File "/home/runner/work/arrow/arrow/ci/scripts/go_bench_adapt.py", line 
94, in _transform_results
       parsed.run_name = f"{parsed.run_reason}: {parsed.github['commit']}"
   TypeError: 'NoneType' object is not subscriptable
   ```
   See e.g.  
https://github.com/apache/arrow/actions/runs/4859969743/jobs/8742255231 -- 
thank you @zeroshade for reporting this.
   
   
   ### What changes are included in this PR?
   
   - Clarification in code via comments
   - More expressive variable naming, type hints
   - Additional assert statement guarding against running 'local dev' code in CI
   - Minor formatting changes via black in VSCode (that's OK I hope?)
   
   A tiny feature/convenience for local dev: the env var 
`CONBENCH_CUSTOM_RUN_REASON` can be used to inject custom info.
   ```python
       # Reflect 'local dev' scenario in run_reason. Allow user to (optionally)
       # inject a custom piece of information into the run reason here, from
       # environment.
       run_reason = "localdev"
       custom_reason_suffix = os.getenv("CONBENCH_CUSTOM_RUN_REASON")
       if custom_reason_suffix is not None:
           run_reason += f" {custom_reason_suffix.strip()}"
   ```
   
   ### Are these changes tested?
   
   No. Relied on mypy/pylint here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to