Commit 78cfd39
[Python] Fix Python Linux distribtests copy conflicts (grpc#39558)
Recently, the Python Linux distribtests have been having flake failures with an error like:
```
+ '[' artifacts '!=' '' ']'
+ cp -r /tmp/tmp.nb7ZJvoaIS/artifacts /tmpfs/altsrc/github/grpc
cp: cannot create regular file '/tmpfs/altsrc/github/grpc/artifacts/grpcio-1.73.0.dev0-cp311-cp311-linux_armv7l.whl': File exists
```
The root cause was found to be one of our recent changes while adding support for musllinux_1_1_aarch64 wheels.
Some context on the Linux distribtests build - As part of building the Linux artifacts (`.whl` files), we have [3 types of build targets](https://github.com/grpc/grpc/blob/master/tools/run_tests/task_runner.py#L29-L32) - `artifact_targets`, `distrib_targets` and `package_targets`.
Recently in Q1, we added support for `musllinux_1_1_aarch64` wheels and separated the build for these wheels into a separate job by using exclude parameters in the original `distribtests_python` config: [Reference](https://github.com/grpc/grpc/blob/master/tools/internal_ci/linux/grpc_distribtests_python.cfg#L30).
While both '[artifact_targets](https://github.com/grpc/grpc/blob/master/tools/internal_ci/linux/grpc_distribtests_python.sh#L44)' and '[distrib_targets](https://github.com/grpc/grpc/blob/master/tools/internal_ci/linux/grpc_distribtests_python.sh#L73)' use these exclude filters during invocation, these exclude filters were missing for the '[package_targets](https://github.com/grpc/grpc/blob/master/tools/internal_ci/linux/grpc_distribtests_python.sh#L56)' causing both package builds to run as below:
```
tools/run_tests/task_runner.py -f package linux python -x build_packages/sponge_log.xml
2025-05-13 16:08:21,278 START: Building targets.
Will build 2 targets:
python_package, labels ['package', 'python', 'linux']
python_package_musllinux_1_1_aarch64, labels ['package', 'python', 'linux', 'musllinux_1_1', 'aarch64']
```
But looking at [build_package_python.sh](https://github.com/grpc/grpc/blob/master/tools/run_tests/artifacts/build_package_python.sh#L24) shows that the job only copies all the built artifacts starting with `python_` with no further filters on the type of architecture, meaning that both jobs were trying to copy all the python built artifacts to the same mounted directory parallely, causing these copy conflicts/race conditions.
To resolve this, the following fixes are done in this PR:
* add exclude flags for musllinux aarch64 while building package_targets
* improve package_targets job to include the exclude flag and selectively copy files, such that `python_package_musllinux_1_1_aarch64` job only copies those artifacts and the `python_package` job doesn't copy the musllinux aarch64 artifacts
* fixed exclude flags logic as it wasn't working as expected
Closes grpc#39558
COPYBARA_INTEGRATE_REVIEW=grpc#39558 from sreenithi:fix_linux_distribtest_cp c51d74e
PiperOrigin-RevId: 7618903651 parent b8cc89c commit 78cfd39
File tree
4 files changed
+29
-10
lines changed- tools
- internal_ci/linux
- run_tests
- artifacts
4 files changed
+29
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
176 | | - | |
| 184 | + | |
177 | 185 | | |
178 | 186 | | |
179 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
0 commit comments