docstr: Reads the output of sacct and returns a dictionary containing main information
docstr_tok: ["Reads","the","output","of","sacct","and","returns","a","dictionary","containing","main","information"]
code: def read_info(
      self, string: tp.Union[bytes, str]
  ) -> tp.Dict[str, tp.Dict[str, str]]:
      """Reads the output of sacct and returns a dictionary containing main information"""
      if not isinstance(string, str):
          string = string.decode()
      lines = string.splitlines()
      if len(lines) < 2:
          return {}  # one job id does not exist (yet)
      names = lines[0].split("|")
      # read all lines
      all_stats: tp.Dict[str, tp.Dict[str, str]] = {}
      for line in lines[1:]:
          stats = {x: y.strip() for x, y in zip(names, line.split("|"))}
          job_id = stats["JobID"]
          if not job_id or "." in job_id:
              continue
          try:
              multi_split_job_id = read_job_id(job_id)
          except Exception as e:
              # Array id are sometimes displayed with weird chars
              warnings.warn(
                  f"Could not interpret {job_id} correctly (please open an issue):\n{e}",
                  DeprecationWarning,
              )
              continue
          for split_job_id in multi_split_job_id:
              all_stats[
                  "_".join(split_job_id[:2])
              ] = stats  # this works for simple jobs, or job array unique instance
              # then, deal with ranges:
              if len(split_job_id) >= 3:
                  for index in range(
                      int(split_job_id[1]), int(split_job_id[2]) + 1
                  ):
                      all_stats[f"{split_job_id[0]}_{index}"] = stats
      return all_stats
  
imports: import functools
  import inspect
  import os
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import typing
  import uuid
  import warnings
  from pathlib import Path
  from ..core import core, job_environment, logger, utils
label_desc: Use image node_id 3 for calling the SlurmInfoWatcher obj's underlying member method code with example usage: obj.read_info(string) and returns: all_stats, dict