code: def test_map_gh23107(init):
      sleep_time = 40
  
      # Reference - https://github.com/ray-project/ray/issues/23107
      @ray.remote
      class DummyActor:
          async def identity(self, s):
              if s == 6:
                  await asyncio.sleep(sleep_time)
              return s, time.time()
  
      def func(a, v):
          return a.identity.remote(v)
  
      map_values = [1, 2, 3, 4, 5]
  
      pool_map = ActorPool([DummyActor.remote() for i in range(2)])
      pool_map.submit(func, 6)
      start_time = time.time()
      gen = pool_map.map(func, map_values)
      assert all(elem[0] in [1, 2, 3, 4, 5] for elem in list(gen))
      assert all(
          abs(elem[1] - start_time) < sleep_time in [1, 2, 3, 4, 5]
          for elem in list(gen)
      )
  
      pool_map_unordered = ActorPool(
          [DummyActor.remote() for i in range(2)]
      )
      pool_map_unordered.submit(func, 6)
      start_time = time.time()
      gen = pool_map_unordered.map_unordered(func, map_values)
      assert all(elem[0] in [1, 2, 3, 4, 5] for elem in list(gen))
      assert all(
          abs(elem[1] - start_time) < sleep_time in [1, 2, 3, 4, 5]
          for elem in list(gen)
      )
  
file_path: ray/python/ray/tests/test_actor_pool.py
imports: import asyncio
  import sys
  import time
  from unittest.mock import MagicMock
  import pytest
  import ray
  from ray.util import ActorPool
label_desc: Use image node_id 7 for calling a global function with example usage: test_map_gh23107(init) and returns: a, s,  time