code: def __init__(self, hosts=None, processes_per_node=1, env=None):
      driver_ip = get_node_ip()
      if hosts is None:  # Single node
          self.hosts = [driver_ip]
      elif hosts == "all":  # All executor nodes in the cluster
  
          def get_ip(iter):
              yield get_node_ip()
  
          from bigdl.util.common import get_node_and_core_number
          from zoo.orca import OrcaContext
  
          sc = OrcaContext.get_spark_context()
          node_num, core_num = get_node_and_core_number()
          total_cores = node_num * core_num
          self.hosts = list(
              set(
                  sc.range(0, total_cores, numSlices=total_cores)
                  .barrier()
                  .mapPartitions(get_ip)
                  .collect()
              )
          )
      else:  # User specified hosts, assumed to be non-duplicate
          assert isinstance(hosts, list)
          self.hosts = hosts
  
      self.master = self.hosts[0]
      print("Master: ", self.master)
      self.remote_hosts = []
      for host in self.hosts:
          if host != driver_ip:
              self.remote_hosts.append(host)
      print("Remote hosts: ", self.remote_hosts)
      print("Hosts: ", self.hosts)
      self.processes_per_node = processes_per_node
      self.env = env if env else {}
  
file_path: analytics-zoo/pyzoo/zoo/orca/learn/mpi/mpi_runner.py
imports: import os
  import sys
  import subprocess
  from zoo.util.utils import get_node_ip
label_desc: Use image node_id 1 to create a new MPIRunner object  with example: obj = MPIRunner(hosts, processes_per_node, env)