code: def session_execute(
      command, env=None, tag=None, fail_fast=False, timeout=120
  ):
      pro = subprocess.Popen(
          command,
          shell=True,
          env=env,
          cwd=None,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          preexec_fn=os.setsid,
      )
      pgid = os.getpgid(pro.pid)
      out, err = pro.communicate(timeout=timeout)
      out = out.decode("utf-8")
      err = err.decode("utf-8")
      print(out)
      print(err)
      errorcode = pro.returncode
      if errorcode != 0:
          if fail_fast:
              invalidOperationError(False, str(err), cause=err)
          print(err)
      else:
          print(out)
      return ProcessInfo(
          out=out,
          err=err,
          errorcode=pro.returncode,
          pgid=pgid,
          pids=pids_from_gpid(pgid),
          tag=tag,
      )
  
file_path: BigDL/python/orca/src/bigdl/orca/ray/process.py
imports: import os
  import subprocess
  from bigdl.orca.ray.utils import is_local
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 2 for calling a global function with example usage: session_execute(command, env, tag, fail_fast, timeout) and returns: ProcessInfo