code: def test_out_of_order_scheduling(shutdown_only):
      """Ensure that when a task runs before its dependency, and they're of the same
      scheduling class, the dependency is eventually able to run."""
      ray.init(num_cpus=1)
  
      @ray.remote
      def foo(arg, path):
          (ref,) = arg
          should_die = not os.path.exists(path)
          with open(path, "w") as f:
              f.write("")
          if should_die:
              print("dying!!!")
              os._exit(-1)
  
          if ref:
              print("hogging the only available slot for a while")
              ray.get(ref)
              return "done!"
  
      with tempfile.TemporaryDirectory() as tmpdir:
          path = f"{tmpdir}/temp.txt"
          first = foo.remote((None,), path)
          second = foo.remote((first,), path)
          print(ray.get(second))
  
file_path: ray/python/ray/tests/test_worker_capping.py
imports: import asyncio
  import os
  import pytest
  import sys
  import tempfile
  import time
  import ray
  from ray._private.test_utils import Semaphore
label_desc: Use image node_id 3 for calling a global function with example usage: test_out_of_order_scheduling(shutdown_only) and returns: str