code: def test_generator_method_does_not_over_retry(shutdown_only):
      counter = Counter.remote()
      trouble_maker = AsyncTroubleMaker.remote()
  
      # Should retry out max_task_retries=3 times
      gen = trouble_maker.yield_or_raise.options(
          retry_exceptions=[MyError]
      ).remote(
          counter,
          [
              # First round
              1,
              MyError(),
              # retry 1
              1,
              MyError(),
              # retry 2,
              1,
              MyError(),
              # retry 3
              1,
              MyError(),
              # no retry 4!
              1,
              2,
          ],
      )
      assert ray.get(next(gen)) == 1
      with pytest.raises(MyError):
          ray.get(next(gen))
      with pytest.raises(StopIteration):
          ray.get(next(gen))
      assert ray.get(counter.get_count.remote()) == 8
  
imports: import os
  import sys
  import pytest
  import ray
label_desc: Use image node_id 6 for calling a global function with example usage: test_generator_method_does_not_over_retry(shutdown_only) without return types