code: def test_max_actors_launch(cpus_per_actor, total_actors, num_masters):
      # By default, there are 50 groups, each group has 1 master and 99 slaves.
      num_slaves_per_master = total_actors / num_masters - 1
  
      @ray.remote(num_cpus=cpus_per_actor)
      class Actor:
          def foo(self):
              pass
  
          def create(self):
              return [
                  Actor.options(max_restarts=-1).remote()
                  for _ in range(num_slaves_per_master)
              ]
  
      print("Start launch actors")
      # The 50 masters are spreaded.
      actors = [
          Actor.options(
              max_restarts=-1, scheduling_strategy="SPREAD"
          ).remote()
          for _ in range(num_masters)
      ]
      slaves_per_master = []
      for master in actors:
          slaves_per_master.append(master.create.remote())
      for slaves in slaves_per_master:
          actors.extend(ray.get(slaves))
      return actors
  
file_path: ray/release/benchmarks/distributed/many_nodes_tests/multi_master_test.py
imports: import argparse
  import os
  from time import sleep, perf_counter
  import json
  import ray
label_desc: Use image node_id 1 for calling a global function with example usage: test_max_actors_launch(cpus_per_actor, total_actors, num_masters) and returns: actors, unknown