xref: /aosp_15_r20/external/pytorch/test/distributed/rpc/test_faulty_agent.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/usr/bin/env python3
2# Owner(s): ["oncall: distributed"]
3
4import sys
5
6import torch
7import torch.distributed as dist
8
9
10if not dist.is_available():
11    print("Distributed not available, skipping tests", file=sys.stderr)
12    sys.exit(0)
13
14from torch.testing._internal.common_utils import IS_CI, run_tests
15from torch.testing._internal.distributed.rpc.faulty_rpc_agent_test_fixture import (
16    FaultyRpcAgentTestFixture,
17)
18from torch.testing._internal.distributed.rpc_utils import (
19    FAULTY_AGENT_TESTS,
20    generate_tests,
21)
22
23
24# On CircleCI these tests are already run on CPU jobs, thus to save resources do
25# not run them on GPU jobs, since thet wouldn't provide additional test signal.
26if not (IS_CI and torch.cuda.is_available()):
27    globals().update(
28        generate_tests(
29            "Faulty",
30            FaultyRpcAgentTestFixture,
31            FAULTY_AGENT_TESTS,
32            __name__,
33        )
34    )
35
36
37if __name__ == "__main__":
38    run_tests()
39