Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix Python 2 regression from #7366 using FileNotFoundError #7381

Merged
merged 2 commits into from
Mar 14, 2019

Conversation

Eric-Arellano
Copy link
Contributor

@Eric-Arellano Eric-Arellano commented Mar 14, 2019

Problem

The function python_interpreter_path() from interpreter_selection_utils.py was originally failing to execute on Py3 because it would encounter FileNotFoundError, which we weren't catching, so we added this to the except statement in #7366.

However, the exception apparently does not exist in Python 2, so the nightly cron job failed: https://travis-ci.org/pantsbuild/pants/jobs/506186166#L952.

Solution

Alias the error if PY2. We use this idiom, rather than a try except, so that we can easily automatically delete this code once we drop Py2.

Result

PY=python2.7 ./build-support/bin/pre-commit.sh now works again.

Good suggestion Daniel!
@Eric-Arellano Eric-Arellano merged commit 552f664 into pantsbuild:master Mar 14, 2019
@Eric-Arellano Eric-Arellano deleted the hotfix-7366 branch March 14, 2019 18:33
Eric-Arellano added a commit to Eric-Arellano/pants that referenced this pull request Mar 18, 2019
Eric-Arellano added a commit that referenced this pull request Mar 18, 2019
…job (#7391)

### Problem
The lint shard is a very cost-effective way to prevent Py2 regressions. For only about 8 minutes of extra total worker time, we can ensure we are always using defined symbols, for example.

This would have prevented #7381 for example. In fact, that PR didn't even properly fix the issue. Running the lint shard during daily CI would have both prevented the issue in the first place and ensured the hotfix worked.

### Solution
Run the lint shard with both Py2 and Py3 during daily CI. No longer run during nightly cron job.

Also fix the issue #7381 was supposed to fix.

### Result
We should have less Python 2 regressions.

While CI will take 10 minutes longer of total worker time, the wall time should not be changed (beyond when we don't have enough workers). This extra time is worth the lowered risk of regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants