code: def test_get_throws_quickly_when_found_exception(ray_start_regular):
      # We use an actor instead of functions here. If we use functions, it's
      # very likely that two normal tasks are submitted before the first worker
      # is registered to Raylet. Since `maximum_startup_concurrency` is 1,
      # the worker pool will wait for the registration of the first worker
      # and skip starting new workers. The result is, the two tasks will be
      # executed sequentially, which breaks an assumption of this test case -
      # the two tasks run in parallel.
      @ray.remote
      class Actor(object):
          def bad_func1(self):
              raise Exception("Test function intentionally failed.")
  
          def bad_func2(self):
              os._exit(0)
  
          def slow_func(self, signal):
              ray.get(signal.wait.remote())
  
      def expect_exception(objects, exception):
          with pytest.raises(ray.exceptions.RayError) as err:
              ray.get(objects)
          assert err.type is exception
  
      signal1 = SignalActor.remote()
      actor = Actor.options(max_concurrency=2).remote()
      expect_exception(
          [actor.bad_func1.remote(), actor.slow_func.remote(signal1)],
          ray.exceptions.RayTaskError,
      )
      ray.get(signal1.send.remote())
  
      signal2 = SignalActor.remote()
      actor = Actor.options(max_concurrency=2).remote()
      expect_exception(
          [actor.bad_func2.remote(), actor.slow_func.remote(signal2)],
          ray.exceptions.RayActorError,
      )
      ray.get(signal2.send.remote())
  
imports: import os
  import signal
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray._private.gcs_utils
  import ray._private.ray_constants
  import ray._private.utils
  from ray._private.test_utils import SignalActor, convert_actor_state, get_error_message, init_error_pubsub, wait_for_condition
  from ray.exceptions import GetTimeoutError, RayActorError, RayTaskError
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_throws_quickly_when_found_exception(ray_start_regular) without return types