code: def _get_nvidia_processes() -> List[GPUProcess]:
      try:
          proc = subprocess.Popen(
              [
                  "nvidia-smi",
                  "--query-compute-apps="
                  + ",".join(GPUProcess._fields),
                  "--format=csv,noheader",
              ],
              stdout=subprocess.PIPE,
              universal_newlines=True,
          )
      except FileNotFoundError:
          logger.info("detected 0 gpu processes (nvidia-smi not found)")
          # This case is expected if NVIDIA drivers are not available.
          return []
      except Exception as e:
          logger.warning(
              f"detected 0 gpu processes (error with nvidia-smi: {e})"
          )
          return []
  
      processes = []
      with proc:
          for field_list in csv.reader(proc.stdout):  # type: ignore
              if len(field_list) != len(GPUProcess._fields):
                  logger.warning(
                      f"Ignoring unexpected nvidia-smi output: {field_list}"
                  )
                  continue
              fields = dict(zip(GPUProcess._fields, field_list))
              try:
                  processes.append(
                      GPUProcess(
                          pid=int(fields["pid"]),
                          process_name=fields["process_name"].strip(),
                          gpu_uuid=fields["gpu_uuid"].strip(),
                          used_memory=fields["used_memory"].strip(),
                      )
                  )
              except ValueError:
                  logger.warning(
                      f"Ignoring GPU process with unexpected nvidia-smi output: {fields}"
                  )
      if proc.returncode:
          logger.warning(
              f"nvidia-smi exited with failure status code {proc.returncode}"
          )
      return processes
  
file_path: determined/harness/determined/gpu.py
imports: import csv
  import json
  import logging
  import subprocess
  from typing import List, NamedTuple, Tuple
label_desc: Use image node_id 6 for calling a global function with example usage: _get_nvidia_processes() and returns: processes, list, list