code: def test_remote_cancel(ray_start_regular, use_force):
      signaler = SignalActor.remote()
  
      @ray.remote
      def wait_for(y):
          return ray.get(y[0])
  
      @ray.remote
      def remote_wait(sg):
          return [wait_for.remote([sg[0]])]
  
      sig = signaler.wait.remote()
  
      outer = remote_wait.remote([sig])
      inner = ray.get(outer)[0]
  
      with pytest.raises(GetTimeoutError):
          ray.get(inner, timeout=1)
  
      ray.cancel(inner, force=use_force)
  
      with pytest.raises(valid_exceptions(use_force)):
          ray.get(inner, timeout=10)
  
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 13 for calling a global function with example usage: test_remote_cancel(ray_start_regular, use_force) and returns: ray, list