code: def wait_for_restore():
      """Wait for Ray actor fault tolerence to restore all failed actors."""
      while True:
          states = [
              # Wait till all actors are either "ALIVE" (retored),
              # or "DEAD" (cancelled. these actors are from other
              # finished test cases).
              a["state"] == "ALIVE" or a["state"] == "DEAD"
              for a in list_actors(
                  filters=[("class_name", "=", "Actor")]
              )
          ]
          print("waiting ... ", states)
          if all(states):
              break
          # Otherwise, wait a bit.
          time.sleep(0.5)
  
imports: import functools
  import os
  from pathlib import Path
  import pickle
  import sys
  import time
  import unittest
  import ray
  from ray.util.state import list_actors
  from ray.rllib.utils.actor_manager import FaultAwareApply, FaultTolerantActorManager
label_desc: Use image node_id 2 for calling a global function with example usage: wait_for_restore() without return types