code: def test_many_custom_resources(shutdown_only):
      # This eventually turns into a command line argument which on windows is
      # limited to 32,767 characters.
      if sys.platform == "win32":
          num_custom_resources = 4000
      else:
          num_custom_resources = 10000
      total_resources = {
          str(i): np.random.randint(1, 7)
          for i in range(num_custom_resources)  # noqa
      }
      ray.init(num_cpus=5, resources=total_resources)
  
      def f():
          return 1
  
      remote_functions = []
      for _ in range(20):
          num_resources = np.random.randint(0, num_custom_resources + 1)
          permuted_resources = np.random.permutation(
              num_custom_resources
          )[:num_resources]
          random_resources = {
              str(i): total_resources[str(i)]
              for i in permuted_resources
          }
          remote_function = ray.remote(resources=random_resources)(f)
          remote_functions.append(remote_function)
  
      remote_functions.append(ray.remote(f))
      remote_functions.append(ray.remote(resources=total_resources)(f))
  
      results = []
      for remote_function in remote_functions:
          results.append(remote_function.remote())
          results.append(remote_function.remote())
          results.append(remote_function.remote())
  
      ray.get(results)
  
imports: import logging
  import os
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import RayTestTimeoutException, wait_for_condition
  from ray.util.placement_group import placement_group
  from ray.util.accelerators import AWS_NEURON_CORE
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 10 for calling a global function with example usage: test_many_custom_resources(shutdown_only) and returns: int