code: def clean_up(exp: dict, reservations):
      env = os.environ.copy()
      env["PDSH_RCMD_TYPE"] = "ssh"
  
      nodes_str = ""
      for reservation in reservations:
          nodes_str += f"{reservation.node.host},"
      nodes_str = nodes_str[:-1]
      logger.debug(
          f"Cleaning up exp_id = {exp['exp_id']} on the following workers: {nodes_str}"
      )
  
      # PDSH flags for max node fan out and specific hosts to launch on
      # See https://linux.die.net/man/1/pdsh for flag details
      pdsh_cmd = ["pdsh", "-f", str(PDSH_MAX_FAN_OUT), "-w", nodes_str]
  
      kill_cmd = [
          "pkill",
          "-f",
          exp["name"],
      ]
      cmd = pdsh_cmd + kill_cmd
      logger.debug("cmd = {}".format(" ".join(cmd)))
  
      result = subprocess.Popen(cmd, env=env)
      result.wait()
  
      # In case of failure must propagate the error-condition back to the caller (usually shell). The
      # actual error and traceback should have been printed in the subprocess, so in order to avoid
      # unnecessary noise we just quietly exit here with the same code as the subprocess
      if result.returncode > 0:
          sys.exit(result.returncode)
  
      logger.info(
          f"Done cleaning up exp_id = {exp['exp_id']} on the following workers: {nodes_str}"
      )
  
imports: import copy
  from numpy import BUFSIZE
  import json
  import subprocess
  import sys
  import threading
  import time
  import base64
  import os
  import hjson
  from tqdm import tqdm
  from ..utils import logger
  from .constants import AUTOTUNING, AUTOTUNING_METRIC_PATH
  from .utils import get_val_by_key, search_error, was_interruptted
  from deepspeed import comm
label_desc: Use image node_id 4 for calling a global function with example usage: clean_up(exp, reservations) without return types