code: def _pick_tqdm_interval(file):
      # Heuristics to pick a update interval for progress bar that's nice-looking for users.
      isatty = file.isatty()
      # Jupyter notebook should be recognized as tty.
      # Wait for https://github.com/ipython/ipykernel/issues/268
      try:
          from ipykernel import iostream
  
          if isinstance(file, iostream.OutStream):
              isatty = True
      except ImportError:
          pass
  
      if isatty:
          return 0.5
      else:
          # When run under mpirun/slurm, isatty is always False.
          # Here we apply some hacky heuristics for slurm.
          if "SLURM_JOB_ID" in os.environ:
              if int(os.environ.get("SLURM_JOB_NUM_NODES", 1)) > 1:
                  # multi-machine job, probably not interactive
                  return 60
              else:
                  # possibly interactive, so let's be conservative
                  return 15
  
          if "OMPI_COMM_WORLD_SIZE" in os.environ:
              return 60
  
          # If not a tty, don't refresh progress bar that often
          return 180
  
file_path: tensorpack/tensorpack/utils/utils.py
imports: import inspect
  import numpy
  import re
  import os
  import sys
  from contextlib import contextmanager
  from datetime import datetime, timedelta
  from tqdm import tqdm
  from .None import logger
  from .concurrency import subproc_call
label_desc: Use image node_id 6 for calling a global function with example usage: _pick_tqdm_interval(file) and returns: int, int, int, int, int