-
-
Notifications
You must be signed in to change notification settings - Fork 610
ignore .pyc files in py_library() targets created in pip_install_dependencies() #825
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
Conversation
…ndencies() .pyc files are not hermetic and ruin hashes for remote-caching. Observed with pypi__pip and pypi__setuptools
This is related to #749. Please, see the related PRs in that description. |
Please, reopen if running as non-root doesn't solve your problem. |
I'm not running |
I verified I'm not running this as WRT #749 the chown on @hrfuller passing @f0rmiga I don't know how to "re-open" this. Do I submit another PR, file an issue, both? |
I reopened. You can just update this PR so we keep the history. |
Looking at the This is because the first run builds the No remote cache, I laz@builder-git_bando ~/git/bando$ bazel query 'deps(@pypi__pip//:lib)' | grep pyc
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded But if I run a target that has it listed as a dependency, the laz@builder-git_bando ~/git/bando$ bazel test //build:requirements_test
(23:53:46) INFO: Current date is 2022-10-12
(23:53:58) INFO: Analyzed target //build:requirements_test (67 packages loaded, 4020 targets configured).
(23:53:58) INFO: Found 1 test target...
Target //build:requirements_test up-to-date:
bazel-bin/build/requirements_test
(23:56:33) INFO: Elapsed time: 167.735s, Critical Path: 154.48s
(23:56:33) INFO: 5 processes: 3 internal, 2 processwrapper-sandbox.
(23:56:33) INFO: Build completed successfully, 5 total actions
//build:requirements_test PASSED in 153.6s
(23:56:33) INFO: Build completed successfully, 5 total actions
laz@builder-git_bando ~/git/bando$ bazel query 'deps(@pypi__pip//:lib)' | grep pyc
Loading: 0 packages loaded
@pypi__pip//:pip/__pycache__/__init__.cpython-310.pyc
@pypi__pip//:pip/__pycache__/__main__.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/__init__.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/build_env.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/cache.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/configuration.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/exceptions.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/pyproject.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/self_outdated_check.cpython-310.pyc
@pypi__pip//:pip/_internal/__pycache__/wheel_builder.cpython-310.pyc
@pypi__pip//:pip/_internal/cli/__pycache__/__init__.cpython-310.pyc
@pypi__pip//:pip/_internal/cli/__pycache__/autocompletion.cpython-310.pyc
@pypi__pip//:pip/_internal/cli/__pycache__/base_command.cpython-310.pyc So for local caching, adding For remote caching, Unless you would prefer doing readonly chowns on every wheel install, like we do with the hermetic python, I think ignoring the |
I don't think making these @mattem what do you think? |
@lazcamus could you resolve the conflicts, please? I'll go ahead and merge this. |
the conflicts are from it being fixed by #881 ... guess I should have added more comments ;) closing this PR :) |
.pyc files are not hermetic and ruin hashes for remote-caching. Observed with pypi__pip and pypi__setuptools
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
The
py_library()
ies created bypip_install_requirements()
have checksums for.pyc
files included. These files don't match from one install to the next, and because they are build inputs they guarantee aremote-cache
miss.I noticed this because the
requirements_test
target that's set up bycompile_pip_requirements()
is never a cache hit in my CI pipeline.Running bazel with
--execution_log_json_file=
allowed me to debug. When run twice on the same machine with a remote-cache, even with abazel clean
in between still yields a cache hit.But when running bazel on 2 different executors (docker containers), then diffing the runs yields only file hash changes:
It seems to only include hashes from
pypi__pip
andpypi__setuptools
.What is the new behavior?
With my patch applied, the remote-cache is a hit on differing CI executors when previously it was not.
Does this PR introduce a breaking change?
Other information