Commit 9983920
[ci][RLlib] [test utils] Improve error message on some test-failures because of
## Why are these changes needed?
In the CI I saw a fleaky test failing, but its error is not reported
correctly:
```python
[2025-07-04T00:01:57Z] Traceback (most recent call last):
[2025-07-04T00:01:57Z] File "/root/.cache/bazel/_bazel_root/1df605deb6d24fc8068f6e25793ec703/execroot/com_github_ray_project_ray/bazel-out/k8-opt/bin/rllib/examples/connectors/multi_agent_observation_preprocessor.runfiles/com_github_ray_project_ray/rllib/examples/connectors/multi_agent_observation_preprocessor.py", line 137, in <module>
[2025-07-04T00:01:57Z] run_rllib_example_script_experiment(base_config, args)
[2025-07-04T00:01:57Z] File "/rayci/python/ray/rllib/utils/test_utils.py", line 1354, in run_rllib_example_script_experiment
[2025-07-04T00:01:57Z] f"{[e.args[0].args[2] for e in results.errors]}"
[2025-07-04T00:01:57Z] File "/rayci/python/ray/rllib/utils/test_utils.py", line 1354, in <listcomp>
[2025-07-04T00:01:57Z] f"{[e.args[0].args[2] for e in results.errors]}" # <---
[2025-07-04T00:01:57Z] IndexError: tuple index out of range # <---
```
In the logs the actual error does not appear because of the `IndexError`
for ` f"{[e.args[0].args[2] for e in results.errors]}"`. I am not sure
why `e.args[0].args[2]` is used, a nested Exception perhaps? This PR
adds a guard to fallback to a simpler `repr(e)` in case the `IndexError`
would accur again. This allows to investigate why this `IndexError`
occures and raises the `RuntimeError` like expected.
## Related issue number
NA
## Checks
- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
- [x] This PR is not tested, but improves other tests :)
---------
Signed-off-by: Daraan <github.blurry@9ox.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Kamil Kaczmarek <kaczmarek.poczta@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>IndexError in test_utils.py (#54343)1 parent 1106b93 commit 9983920
1 file changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1362 | 1362 | | |
1363 | 1363 | | |
1364 | 1364 | | |
1365 | | - | |
| 1365 | + | |
1366 | 1366 | | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1367 | 1374 | | |
1368 | | - | |
1369 | | - | |
| 1375 | + | |
1370 | 1376 | | |
1371 | 1377 | | |
1372 | 1378 | | |
| |||
0 commit comments