Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions test/distributed/rpc/faulty_agent/test_dist_autograd_spawn.py

This file was deleted.

19 changes: 0 additions & 19 deletions test/distributed/rpc/faulty_agent/test_rpc_spawn.py

This file was deleted.

21 changes: 0 additions & 21 deletions test/distributed/rpc/jit/faulty_agent/test_rpc_spawn.py

This file was deleted.

46 changes: 46 additions & 0 deletions test/distributed/rpc/test_faulty_agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
import unittest

from torch.testing._internal.common_distributed import MultiProcessTestCase
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my comment in #40816 (comment), is it possible to avoid having separate files and enable different agents based on env variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment there.

from torch.testing._internal.common_utils import TEST_WITH_ASAN, run_tests
from torch.testing._internal.distributed.rpc.dist_autograd_test import (
FaultyAgentDistAutogradTest,
)
from torch.testing._internal.distributed.rpc.faulty_rpc_agent_test_fixture import (
FaultyRpcAgentTestFixture,
)
from torch.testing._internal.distributed.rpc.jit.rpc_test_faulty import (
JitFaultyAgentRpcTest,
)
from torch.testing._internal.distributed.rpc.rpc_test import FaultyAgentRpcTest


@unittest.skipIf(
TEST_WITH_ASAN, "Skip ASAN as torch + multiprocessing spawn have known issues"
)
class SpawnHelper(MultiProcessTestCase):
def setUp(self):
super().setUp()
self._spawn_processes()


class FaultyRpcTestWithSpawn(
FaultyRpcAgentTestFixture, FaultyAgentRpcTest, SpawnHelper
):
pass


class FaultyDistAutogradTestWithSpawn(
FaultyRpcAgentTestFixture, FaultyAgentDistAutogradTest, SpawnHelper
):
pass


class FaultyJitRpcTestWithSpawn(
FaultyRpcAgentTestFixture, JitFaultyAgentRpcTest, SpawnHelper
):
pass


if __name__ == "__main__":
run_tests()
10 changes: 3 additions & 7 deletions test/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@
'test_profiler',
'distributed/nn/jit/test_instantiator',
'distributed/nn/api/test_remote_module_spawn',
'distributed/rpc/faulty_agent/test_dist_autograd_spawn',
'distributed/rpc/faulty_agent/test_rpc_spawn',
'distributed/rpc/test_faulty_agent',
'distributed/rpc/jit/test_dist_autograd_spawn',
'distributed/rpc/test_tensorpipe_agent',
'distributed/rpc/test_dist_autograd_spawn',
Expand All @@ -88,16 +87,14 @@
'test_jit_py3',
'test_determination',
'distributed/rpc/jit/test_rpc_spawn',
'distributed/rpc/faulty_agent/test_rpc_spawn',
'test_futures',
'distributed/test_ddp_under_dist_autograd',
]

WINDOWS_BLOCKLIST = [
'distributed/nn/jit/test_instantiator',
'distributed/nn/api/test_remote_module_spawn',
'distributed/rpc/faulty_agent/test_dist_autograd_spawn',
'distributed/rpc/faulty_agent/test_rpc_spawn',
'distributed/rpc/test_faulty_agent',
'distributed/rpc/jit/test_dist_autograd_spawn',
'distributed/rpc/jit/test_rpc_spawn',
'distributed/rpc/test_tensorpipe_agent',
Expand All @@ -111,8 +108,7 @@
ROCM_BLOCKLIST = [
'distributed/nn/jit/test_instantiator',
'distributed/nn/api/test_remote_module_spawn',
'distributed/rpc/faulty_agent/test_dist_autograd_spawn',
'distributed/rpc/faulty_agent/test_rpc_spawn',
'distributed/rpc/test_faulty_agent',
'distributed/rpc/jit/test_dist_autograd_spawn',
'distributed/rpc/jit/test_rpc_spawn',
'distributed/rpc/test_tensorpipe_agent',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
from torch.testing._internal.distributed.rpc.rpc_agent_test_fixture import (
RpcAgentTestFixture,
)
from torch.testing._internal.distributed.rpc.faulty_rpc_agent_test_fixture import (
FaultyRpcAgentTestFixture,
)
from torch.testing._internal.common_distributed import skip_if_lt_x_gpu


Expand Down Expand Up @@ -2198,7 +2195,7 @@ def test_gpu_to_cpu_continuation_gpu_root(self):
local_grads = ret if ret else local_grads


class FaultyAgentDistAutogradTest(FaultyRpcAgentTestFixture):
class FaultyAgentDistAutogradTest(RpcAgentTestFixture):
# Reusing a simplified helper function from DistAutogradTest to ensure
# autograd context is successfully cleaned up even when RPCs are failing.
def context_cleanup_test_helper(self, rpc_args, func):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
worker_name,
wait_until_pending_futures_and_users_flushed
)
from torch.testing._internal.distributed.rpc.faulty_rpc_agent_test_fixture import (
FaultyRpcAgentTestFixture,
from torch.testing._internal.distributed.rpc.rpc_agent_test_fixture import (
RpcAgentTestFixture,
)


Expand Down Expand Up @@ -82,7 +82,7 @@ def rpc_async_with_rref_arg(dst_worker_name, args):
return ret


class JitFaultyAgentRpcTest(FaultyRpcAgentTestFixture):
class JitFaultyAgentRpcTest(RpcAgentTestFixture):
"""
Run tests for rpc_async in JIT under the faulty agent test fixture to test
arbitrary timeouts.
Expand Down
5 changes: 1 addition & 4 deletions torch/testing/_internal/distributed/rpc/rpc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
RpcAgentTestFixture,
)
from torch.testing._internal.common_utils import TemporaryFileName
from torch.testing._internal.distributed.rpc.faulty_rpc_agent_test_fixture import (
FaultyRpcAgentTestFixture,
)


def foo_add():
Expand Down Expand Up @@ -3432,7 +3429,7 @@ def test_wait_all_with_partial_exception(self):
ret = torch.futures.wait_all(futs)


class FaultyAgentRpcTest(FaultyRpcAgentTestFixture):
class FaultyAgentRpcTest(RpcAgentTestFixture):

# no faulty_messages defined so this fails all retryable messages - see
# faulty_rpc_agent_test_fixture.py for the list of retryable messages.
Expand Down