code: def test_ray_options(shutdown_only):
      ray.init(num_cpus=10, num_gpus=10, resources={"custom1": 2})
  
      @ray.remote(
          num_cpus=2,
          num_gpus=3,
          memory=150 * 2**20,
          resources={"custom1": 1},
      )
      def foo(expected_resources):
          # Possibly wait until the available resources have been updated
          # (there might be a delay due to heartbeats)
          retries = 10
          keys = ["CPU", "GPU", "custom1"]
          while retries >= 0:
              resources = ray.available_resources()
              do_return = True
              for key in keys:
                  if resources[key] != expected_resources[key]:
                      print(
                          key, resources[key], expected_resources[key]
                      )
                      do_return = False
                      break
              if do_return:
                  return resources["memory"]
              time.sleep(0.1)
              retries -= 1
          raise RuntimeError("Number of retries exceeded")
  
      expected_resources_without_options = {
          "CPU": 8.0,
          "GPU": 7.0,
          "custom1": 1.0,
      }
      memory_available_without_options = ray.get(
          foo.remote(expected_resources_without_options)
      )
  
      expected_resources_with_options = {
          "CPU": 7.0,
          "GPU": 6.0,
          "custom1": 1.5,
      }
      memory_available_with_options = ray.get(
          foo.options(
              num_cpus=3,
              num_gpus=4,
              memory=50 * 2**20,
              resources={"custom1": 0.5},
          ).remote(expected_resources_with_options)
      )
  
      assert (
          memory_available_without_options
          < memory_available_with_options
      )
  
imports: import logging
  import os
  import pickle
  import random
  import sys
  import time
  import pytest
  import ray
  import ray.cluster_utils
  from ray._private.test_utils import SignalActor, client_test_enabled, get_error_message, run_string_as_driver
label_desc: Use image node_id 16 for calling a global function with example usage: test_ray_options(shutdown_only) and returns: resources