code: def test_submit_api(shutdown_only):
      ray.init(num_cpus=2, num_gpus=1, resources={"Custom": 1})
  
      @ray.remote
      def f(n):
          return list(range(n))
  
      @ray.remote
      def g():
          return ray.get_gpu_ids()
  
      assert f._remote([0], num_returns=0) is None
      id1 = f._remote(args=[1], num_returns=1)
      assert ray.get(id1) == [0]
      id1, id2 = f._remote(args=[2], num_returns=2)
      assert ray.get([id1, id2]) == [0, 1]
      id1, id2, id3 = f._remote(args=[3], num_returns=3)
      assert ray.get([id1, id2, id3]) == [0, 1, 2]
      assert ray.get(
          g._remote(
              args=[], num_cpus=1, num_gpus=1, resources={"Custom": 1}
          )
      ) == [0]
      infeasible_id = g._remote(
          args=[], resources={"NonexistentCustom": 1}
      )
      assert ray.get(g._remote()) == []
      ready_ids, remaining_ids = ray.wait([infeasible_id], timeout=0.05)
      assert len(ready_ids) == 0
      assert len(remaining_ids) == 1
  
      # Check mismatch with num_returns.
      with pytest.raises(ValueError):
          ray.get(f.options(num_returns=2).remote(3))
      with pytest.raises(ValueError):
          ray.get(f.options(num_returns=3).remote(2))
  
      @ray.remote
      class Actor:
          def __init__(self, x, y=0):
              self.x = x
              self.y = y
  
          def method(self, a, b=0):
              return self.x, self.y, a, b
  
          def gpu_ids(self):
              return ray.get_gpu_ids()
  
      @ray.remote
      class Actor2:
          def __init__(self):
              pass
  
          def method(self):
              pass
  
      a = Actor._remote(
          args=[0], kwargs={"y": 1}, num_gpus=1, resources={"Custom": 1}
      )
  
      a2 = Actor2._remote()
      ray.get(a2.method._remote())
  
      id1, id2, id3, id4 = a.method._remote(
          args=["test"], kwargs={"b": 2}, num_returns=4
      )
      assert ray.get([id1, id2, id3, id4]) == [0, 1, "test", 2]
  
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 9 for calling a global function with example usage: test_submit_api(shutdown_only) and returns: list, ray, self,  self,  a,  b, ray