code: def test_single_cpu_cancel(shutdown_only, use_force):
      ray.init(num_cpus=1)
      signaler = SignalActor.remote()
  
      @ray.remote
      def wait_for(t):
          return ray.get(t[0])
  
      obj1 = wait_for.remote([signaler.wait.remote()])
      obj2 = wait_for.remote([obj1])
      obj3 = wait_for.remote([obj2])
      indep = wait_for.remote([signaler.wait.remote()])
  
      assert len(ray.wait([obj3], timeout=0.1)[0]) == 0
      ray.cancel(obj3, force=use_force)
      with pytest.raises(valid_exceptions(use_force)):
          ray.get(obj3)
  
      ray.cancel(obj1, force=use_force)
  
      for d in [obj1, obj2]:
          with pytest.raises(valid_exceptions(use_force)):
              ray.get(d)
  
      signaler.send.remote()
      ray.get(indep)
  
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 9 for calling a global function with example usage: test_single_cpu_cancel(shutdown_only, use_force) and returns: ray