Return TensorBoardInfo values for running TensorBoard processes.

  This function may not provide a perfect snapshot of the set of running
  processes. Its result set may be incomplete if the user has cleaned
  their /tmp/ directory while TensorBoard processes are running. It may
  contain extraneous entries if TensorBoard processes exited uncleanly
  (e.g., with SIGKILL or SIGQUIT).

  Returns:
    A fresh list of `TensorBoardInfo` objects.

def get_all():
  """Return TensorBoardInfo values for running TensorBoard processes.

  This function may not provide a perfect snapshot of the set of running
  processes. Its result set may be incomplete if the user has cleaned
  their /tmp/ directory while TensorBoard processes are running. It may
  contain extraneous entries if TensorBoard processes exited uncleanly
  (e.g., with SIGKILL or SIGQUIT).

  Returns:
    A fresh list of `TensorBoardInfo` objects.
  """
  info_dir = _get_info_dir()
  results = []
  for filename in os.listdir(info_dir):
    filepath = os.path.join(info_dir, filename)
    try:
      with open(filepath) as infile:
        contents = infile.read()
    except IOError as e:
      if e.errno == errno.EACCES:
        # May have been written by this module in a process whose
        # `umask` includes some bits of 0o444.
        continue
      else:
        raise
    try:
      info = _info_from_string(contents)
    except ValueError:
      tb_logging.get_logger().warning(
          "invalid info file: %r",
          filepath,
          exc_info=True,
      )
    else:
      results.append(info)
  return results