Treat an empty subset selection as success in modal-torch-latest (#9053)
The modal-torch-latest GPU controller (ci/torch_latest.py) runs pytest
remotely in a Modal sandbox / AWS instance and treats any nonzero pytest
exit as a candidate failure. A diff-selected (subset) run whose only
targets skip on the runner collects nothing, so pytest exits 5 ("no
tests collected") and the job fails red even though the run is a
legitimate green no-op.
Observed on run 42921207259 (merge_group for #8867): the selector picked
only tests/unit/v1/accelerator/test_klxpu_accelerator.py, which is
module-level skipped on NVIDIA runners, so pytest reported "4 workers [0
items]" / "1 skipped" and the controller raised RemoteCommandError: run
pytest failed with exit code 5.
This mirrors the merged sibling fix for cpu-torch-latest-v1-multirank
(#9032), which maps pytest exit 5 to a green skip for subset selections.
That fix only touched the CPU workflow's shell step; the GPU controller
delegates all run/classify logic to ci/torch_latest.py, so the
equivalent guard belongs there and must cover both the Modal and AWS
backends.
- Add EXIT_NO_TESTS = 5 and a shared EMPTY_SELECTION_MESSAGE.
- run_controller (Modal): a "run pytest" failure with code 5 in subset
mode returns 0 with the message instead of raising.
- run_aws_controller (AWS): same guard on test_code.
- Gate on selection_mode == "subset"; mode=all runs the whole
tests/unit/v1 scope, where an empty collection means the selector or a
collection guard broke and must still fail. Other exit codes (1, 124)
are unchanged.
- Add controller/AWS tests for the subset no-op and the mode=all guard.
AI assistance was used to analyze the failing run and draft this patch.
Signed-off-by: guhangsong <guhangsong@outlook.com>
Co-authored-by: Ma, Guokai <guokai.ma@gmail.com>