code: def test_method_raise_and_exit(
      actions, is_async, max_restarts, _max_retries, shutdown_only
  ):
      """
      Test we can endure a mix of raises and exits. Note the number of exits we can endure
      is subject to max_restarts.
  
      The retry behavior should work for Async actors.
      The retry behavior should work if the _max_retries or max_restarts are -1 (infinite
          retry).
      """
      actor_class = AsyncTroubleMaker if is_async else TroubleMaker
      counter = Counter.remote()
      trouble_maker = actor_class.options(
          max_restarts=max_restarts
      ).remote()
      assert (
          ray.get(
              trouble_maker.raise_or_exit.options(
                  _max_retries=_max_retries
              ).remote(counter, actions)
          )
          == 3
      )
      # 4 = 1 initial + 3 retries (with the 1 restart included)
      assert ray.get(counter.get_count.remote()) == 4
  
imports: import os
  import sys
  import pytest
  import ray
label_desc: Use image node_id 9 for calling a global function with example usage: test_method_raise_and_exit(actions, is_async, max_restarts, _max_retries, shutdown_only) without return types