class_docstr: A runner to execute commands on an array of machines. This runner
  is inspired by Nezha (https://github.com/zhuzilin/NeZha).
class_docstr_tok: ["A","runner","to","execute","commands","on","an","array","of","machines",".","This","runner","is","inspired","by","Nezha","(","https",":","\/\/github.com\/zhuzilin\/NeZha",")","."]
docstr: Establish connections to a list of hosts
  
  Args:
      host_info_list (HostInfoList): a list of HostInfo objects
      workdir (str): the directory where command is executed
      env (dict): environment variables to propagate to hosts
docstr_tok: ["Establish","connections","to","a","list","of","hosts","Args",":","host_info_list","(","HostInfoList",")",":","a","list","of","HostInfo","objects","workdir","(","str",")",":","the","directory","where","command","is","executed","env","(","dict",")",":","environment","variables","to","propagate","to","hosts"]
code: def connect(
      self, host_info_list: HostInfoList, workdir: str, env: dict
  ) -> None:
      """
      Establish connections to a list of hosts
  
      Args:
          host_info_list (HostInfoList): a list of HostInfo objects
          workdir (str): the directory where command is executed
          env (dict): environment variables to propagate to hosts
      """
      for hostinfo in host_info_list:
          master_send_conn, worker_recv_conn = Pipe()
          master_recv_conn, worker_send_conn = Pipe()
          p = Process(
              target=run_on_host,
              args=(
                  hostinfo,
                  workdir,
                  worker_recv_conn,
                  worker_send_conn,
                  env,
              ),
          )
          p.start()
          self.processes[hostinfo.hostname] = p
          self.master_recv_conns[hostinfo.hostname] = master_recv_conn
          self.master_send_conns[hostinfo.hostname] = master_send_conn
  
file_path: ColossalAI/colossalai/cli/launcher/multinode_runner.py
imports: from multiprocessing import Pipe, Process
  from multiprocessing import connection
  import click
  import fabric
  from .hostinfo import HostInfo, HostInfoList
label_desc: Use image node_id 2 for calling the MultiNodeRunner obj's underlying member method code with example usage: obj.connect(host_info_list, workdir, env) without return types