code: def test_ray_intentional_errors(shutdown_only):
      """
      Test in the below cases, ray task should not be marked as failure:
      1. ray.actor_exit_actor()
      2. __ray_terminate__.remote()
      3. max calls reached.
      4. task that exit with exit(0)
      """
  
      # Test `exit_actor`
      @ray.remote
      class Actor:
          def ready(self):
              pass
  
          def exit(self):
              ray.actor.exit_actor()
  
          def exit_normal(self):
              exit(0)
  
      ray.init(num_cpus=1)
  
      a = Actor.remote()
      ray.get(a.ready.remote())
  
      a.exit.remote()
  
      def verify():
          ts = list_tasks(filters=[("name", "=", "Actor.exit")])
          assert len(ts) == 1
          t = ts[0]
  
          assert t["state"] == "FINISHED"
          return True
  
      wait_for_condition(verify)
  
      # Test `__ray_terminate__`
      b = Actor.remote()
  
      ray.get(b.ready.remote())
  
      b.__ray_terminate__.remote()
  
      def verify():
          ts = list_tasks(
              filters=[("name", "=", "Actor.__ray_terminate__")]
          )
          assert len(ts) == 1
          t = ts[0]
  
          assert t["state"] == "FINISHED"
          return True
  
      wait_for_condition(verify)
  
      # Test max calls reached exiting workers should not fail the task.
      @ray.remote(max_calls=1)
      def f():
          pass
  
      for _ in range(3):
          ray.get(f.remote())
  
      def verify():
          ts = list_tasks(filters=[("name", "=", "f")])
          assert len(ts) == 3
          workers = set()
          for t in ts:
              assert t["state"] == "FINISHED"
              workers.add(t["worker_id"])
  
          assert len(workers) == 3
          return True
  
      wait_for_condition(verify)
  
      # Test tasks that fail with exit(0)
      @ray.remote
      def g():
          exit(0)
  
      def verify():
          ts = list_tasks(filters=[("name", "=", "g")])
          assert len(ts) == 1
          t = ts[0]
  
          assert t["state"] == "FINISHED"
          return True
  
      c = Actor.remote()
      ray.get(c.ready.remote())
  
      c.exit_normal.remote()
  
      def verify():
          ts = list_tasks(filters=[("name", "=", "Actor.exit_normal")])
          assert len(ts) == 1
          t = ts[0]
  
          assert t["state"] == "FINISHED"
          return True
  
      wait_for_condition(verify)
  
imports: import asyncio
  from collections import defaultdict
  import os
  from typing import Dict
  import pytest
  import sys
  import time
  from ray._private import ray_constants
  from functools import reduce
  import ray
  from ray._private.state_api_test_utils import PidActor, get_state_api_manager, verify_tasks_running_or_terminated, verify_failed_task
  from ray.util.state.common import ListApiOptions, StateResource
  from ray._private.test_utils import async_wait_for_condition_async_predicate, run_string_as_driver, run_string_as_driver_nonblocking, wait_for_condition
  from ray.util.state import StateApiClient, list_actors, list_jobs, list_tasks
label_desc: Use image node_id 12 for calling a global function with example usage: test_ray_intentional_errors(shutdown_only) and returns: True, True, True, True, True