code: def test_map(pool_4_processes):
      def f(index):
          return index, os.getpid()
  
      results = pool_4_processes.map(f, range(1000))
      assert len(results) == 1000
  
      pid_counts = defaultdict(int)
      for i, (index, pid) in enumerate(results):
          assert i == index
          pid_counts[pid] += 1
  
      # Check that the functions are spread somewhat evenly.
      for count in pid_counts.values():
          assert count > 100
  
      def bad_func(args):
          raise Exception("test_map failure")
  
      with pytest.raises(Exception, match="test_map failure"):
          pool_4_processes.map(bad_func, range(100))
  
imports: import os
  import sys
  import platform
  import pytest
  import tempfile
  import time
  import random
  from collections import defaultdict
  import queue
  import math
  import ray
  from ray._private.test_utils import SignalActor
  from ray.util.multiprocessing import Pool, TimeoutError, JoinableQueue
  from ray.util.joblib import register_ray
  from joblib import parallel_backend, Parallel, delayed
label_desc: Use image node_id 14 for calling a global function with example usage: test_map(pool_4_processes) and returns: index,  os