code: def test_task_name_not_changed_for_iteration(shutdown_only):
      """Handles https://github.com/ray-project/ray/issues/37147.
      Verify the task_name is not changed for each iteration in
      async actor generator task.
      """
  
      @ray.remote
      class A:
          async def gen(self):
              task_name = asyncio.current_task().get_name()
              for i in range(5):
                  assert (
                      task_name == asyncio.current_task().get_name()
                  ), f"{task_name} != {asyncio.current_task().get_name()}"
                  yield i
  
              assert task_name == asyncio.current_task().get_name()
  
      a = A.remote()
      for obj_ref in a.gen.remote():
          print(ray.get(obj_ref))
  
file_path: ray/python/ray/tests/test_streaming_generator_2.py
imports: import asyncio
  import pytest
  import numpy
  import sys
  import time
  import gc
  import ray
  from ray.experimental.state.api import list_actors
label_desc: Use image node_id 6 for calling a global function with example usage: test_task_name_not_changed_for_iteration(shutdown_only) without return types