code: def test_thread_create_task(shutdown_only):
      @ray.remote
      def thread_create_task():
          assert ray._private.worker.global_worker.task_depth == 1
  
          global has_exception
          has_exception = False
  
          @ray.remote
          def check_nested_depth():
              assert ray._private.worker.global_worker.task_depth == 2
  
          def run_check_nested_depth():
              try:
                  ray.get(
                      check_nested_depth.options(max_retries=0).remote()
                  )
              except Exception:
                  global has_exception
                  has_exception = True
  
          t1 = threading.Thread(target=run_check_nested_depth)
          t1.start()
          t1.join()
  
          assert not has_exception
  
      ray.get(thread_create_task.remote())
  
file_path: ray/python/ray/tests/test_nested_task.py
imports: import sys
  import threading
  import pytest
  import ray
label_desc: Use image node_id 9 for calling a global function with example usage: test_thread_create_task(shutdown_only) without return types