bazel-contrib / bazel-contrib/rules_python
Hermetic toolchains incur a significant overhead to running py_binary and py_test
- Ngôn ngữ chính
- Starlark
- Star
- 688
- Fork
- 721
- Merge trung bình
- 15 giờ 7 phút
- Pull request đã merge (30 ngày)
- 76
Mô tả
# 🐞 bug report
### Affected Rule
`py_binary` and `py_test`
### Is this a regression?
No
### Description
Hermetic toolchains incur a significant overhead to executing Python targets due to the large amount of files which are added to the runfiles tree.
You find an analysis of the issue here: https://github.com/martis42/show_hermetic_python_overhead
Bazel caching of course negates much of this issue in daily working.
Still, whenever a test has to rerun we pay this additional overhead.
I don't know if there is a "perfect" solution possible given how Bazel sandboxing works.
However, it would be great if rues_python would add a note in its documentation for hermetic toolchains that adding `--nolegacy_external_runfiles` to the `.bazelrc` file is recommended.
Maybe the `rules_python` maintainer can even convince the Bazel maintainer to prioritize working on flipping `--legacy_external_runfiles` in Bazel 8 ?
## 🔬 Minimal Reproduction
You see reproduce this with this small example workspace https://github.com/martis42/show_hermetic_python_overhead
## 🔥 Exception or Error
NA
## 🌍 Your Environment
**Operating System:**
Linux Mint 21.1
**Output of `bazel version`:**
Bazelisk version: v1.16.0
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:51:49 2023 (1702313509)
Build timestamp: 1702313509
Build timestamp as int: 1702313509
**Rules_python version:**
0.27.0
**Anything else relevant?**
https://github.com/bazelbuild/rules_python/issues/1624 might be related.
It is however maybe Windows specific.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với workspace show_hermetic_python_overhead được liên kết và so sánh việc thực thi py_binary và py_test với các toolchain hermetic. Đọc tài liệu hermetic-toolchain và thiết lập --nolegacy_external_runfiles trong .bazelrc; công việc được hoàn thành khi overhead và khuyến nghị được ghi lại rõ ràng, hoặc khi hạn chế được giải thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- build-system, performance
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100