code: def test_actor_call_task_call_actor(shutdown_only):
      @ray.remote
      class TestActor:
          def __init__(self, expected_depth=1):
              task_depth = ray._private.worker.global_worker.task_depth
              assert task_depth == expected_depth
  
          def run(self, spawn_task=False, expected_depth=1):
              task_depth = ray._private.worker.global_worker.task_depth
              assert task_depth == expected_depth
  
              if spawn_task:
                  ray.get(
                      call_actor.remote(
                          self,
                          spawn_task=False,
                          expected_depth=expected_depth + 1,
                      )
                  )
  
      @ray.remote
      def call_actor(actor, spawn_task=False, expected_depth=1):
          task_depth = ray._private.worker.global_worker.task_depth
          assert task_depth == expected_depth
  
          ray.get(
              actor.run.remote(
                  spawn_task=spawn_task, expected_depth=task_depth + 1
              )
          )
  
      actor = TestActor.remote()
      actor.run.remote(spawn_task=True)
  
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 7 for calling a global function with example usage: test_actor_call_task_call_actor(shutdown_only) without return types