code: def test_recursive_cancel(shutdown_only, use_force):
      ray.init(num_cpus=4)
  
      @ray.remote(num_cpus=1)
      def inner():
          while True:
              time.sleep(0.1)
  
      @ray.remote(num_cpus=1)
      def outer():
          x = [inner.remote()]
          print(x)
          while True:
              time.sleep(0.1)
  
      @ray.remote(num_cpus=4)
      def many_resources():
          return 300
  
      outer_fut = outer.remote()
      many_fut = many_resources.remote()
      with pytest.raises(GetTimeoutError):
          ray.get(many_fut, timeout=1)
      ray.cancel(outer_fut)
      with pytest.raises(valid_exceptions(use_force)):
          ray.get(outer_fut, timeout=10)
  
      assert ray.get(many_fut, timeout=30)
  
imports: import os
  import random
  import signal
  import sys
  import threading
  import _thread
  import time
  import pytest
  import ray
  from ray.exceptions import TaskCancelledError, RayTaskError, GetTimeoutError, WorkerCrashedError, ObjectLostError
  from ray._private.utils import DeferSigint
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.util.state import list_tasks
label_desc: Use image node_id 14 for calling a global function with example usage: test_recursive_cancel(shutdown_only, use_force) and returns: int