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

Fix remote cache miss #748

Closed
wants to merge 1 commit into from

Conversation

jheaff1
Copy link
Contributor

@jheaff1 jheaff1 commented Jul 12, 2022

In some cases, the hermetic python toolchain would generate .pyc files
when being used, resulting in a remote cache miss. This commit excludes
generated files from the "files" filegroup to resolve this issue

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

In some cases, the hermetic python toolchain would generate .pyc files
when being used, resulting in a remote cache miss. This commit excludes
generated files from the "files" filegroup to resolve this issue
@jheaff1 jheaff1 marked this pull request as ready for review July 12, 2022 12:12
@hrfuller hrfuller requested a review from f0rmiga July 12, 2022 18:00
Copy link
Contributor

@hrfuller hrfuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Could you please clarify when the pyc's are generated. Is it during some build step of the hermetic interpreter external repo?

@f0rmiga
Copy link
Collaborator

f0rmiga commented Jul 12, 2022

Please, see: #713.

@f0rmiga f0rmiga closed this Jul 12, 2022
@jheaff1
Copy link
Contributor Author

jheaff1 commented Jul 12, 2022

After reading #713, it seems that the issue shouldn’t occur if not building as root. I was indeed building as the root user “ContainerAdministrator” within a Windows Container. I’ll try building as non-root. Thanks!

@f0rmiga
Copy link
Collaborator

f0rmiga commented Jul 12, 2022

Cool! I'm working on a solution to warn the user about this.

@f0rmiga
Copy link
Collaborator

f0rmiga commented Jul 12, 2022

@jheaff1 I created #749. I'll add the same functionality under Windows next.

@jheaff1
Copy link
Contributor Author

jheaff1 commented Jul 13, 2022

@f0rmiga This issue does indeed go away when building as non-root, however when building as non-root in a Windows Container, symlinks cannot be created, which prevents the usage of features like --enable_runfiles (See here), which is used in rules_python in fact:

rules_python/.bazelrc

Lines 19 to 22 in aef17ad

# Windows makes use of runfiles for some rules
build --enable_runfiles
# TODO(f0rmiga): remove this so that other features don't start relying on it.
startup --windows_enable_symlinks

Given this scenario, and perhaps others where it is troublesome to build as non-root, should we instead exclude the pyc files from the filegroup?

@f0rmiga
Copy link
Collaborator

f0rmiga commented Jul 13, 2022

Then, I guess we should exclude unconditionally under Windows only. Thanks for the extra info on Windows!

@f0rmiga
Copy link
Collaborator

f0rmiga commented Jul 13, 2022

Another thing we can add is an attribute to exclude them under Linux too.

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.

3 participants