code: def get_all_remote_pids(hosts, ssh_port, udf_command):
      """Get all remote processes."""
      remote_pids = {}
      for node_id, host in enumerate(hosts):
          ip, _ = host
          # When creating training processes in remote machines, we may insert some arguments
          # in the commands. We need to use regular expressions to match the modified command.
          cmds = udf_command.split()
          new_udf_command = " .*".join(cmds)
          pids = get_remote_pids(ip, ssh_port, new_udf_command)
          remote_pids[(ip, ssh_port)] = pids
      return remote_pids
  
imports: import argparse
  import json
  import logging
  import multiprocessing
  import os
  import queue
  import re
  import signal
  import subprocess
  import sys
  import time
  from functools import partial
  from threading import Thread
  from typing import Optional
label_desc: Use image node_id 6 for calling a global function with example usage: get_all_remote_pids(hosts, ssh_port, udf_command) and returns: remote_pids