code: def test_run_max_retries_exceeded(self):
      for restartable_state in [
          monres(WorkerState.FAILED),
          monres(WorkerState.UNHEALTHY),
      ]:
          with patch.object(
              TestAgent,
              "_monitor_workers",
              return_value=restartable_state,
          ) as mock_monitor_workers:
              spec = self._get_worker_spec(
                  max_restarts=3, monitor_interval=0.1
              )
              agent = TestAgent(spec)
              worker_group = agent._worker_group
  
              agent.run()
              self.assertEqual(WorkerState.FAILED, worker_group.state)
              self.assertEqual(0, agent._remaining_restarts)
              # one monitor call for each retry + one to monitor the last retry
              self.assertEqual(
                  spec.max_restarts + 1, mock_monitor_workers.call_count
              )
  
imports: import signal
  import unittest
  import uuid
  from typing import Any, Dict
  from unittest.mock import call, patch, MagicMock
  import torch.distributed.elastic.rendezvous.registry
  from torch.distributed.elastic.agent.server.api import RunResult, SimpleElasticAgent, WorkerGroup, WorkerSpec, WorkerState, _get_fq_hostname, _RoleInstanceInfo
  from torch.distributed.elastic.multiprocessing import SignalException
  from torch.distributed.elastic.multiprocessing.errors import ProcessFailure
  from torch.distributed.elastic.rendezvous import RendezvousHandler, RendezvousParameters
  from torch.distributed.elastic.utils.distributed import get_free_port
  from torch.testing._internal.common_utils import run_tests
label_desc: Use image node_id 19 for calling the SimpleElasticAgentTest obj's underlying member method code with example usage: obj.test_run_max_retries_exceeded() without return types