code: def _run_tensorboard(args):
      from guild import tensorboard
  
      tensorboard.setup_logging()
      with util.TempDir(
          "guild-tensorboard-", keep=_keep_logdir(args)
      ) as tmp:
          logdir = tmp.path
          (log.info if args.keep_logdir else log.debug)(
              "Using logdir %s", logdir
          )
          tensorboard_options = _tensorboard_options(args)
          monitor = tensorboard.RunsMonitor(
              logdir,
              _list_runs_cb(args),
              interval=args.refresh_interval,
              log_images=not args.skip_images,
              log_hparams=not args.skip_hparams,
              run_name_cb=_run_name_cb(args),
          )
          t0 = time.time()
          cli.out("Preparing runs for TensorBoard")
          monitor.run_once(exit_on_error=True)
          if args.test_logdir:
              cli.out(f"Initialized log dir {logdir}")
              return
          _maybe_log_prepare_time(t0)
          monitor.start()
          try:
              tensorboard.serve_forever(
                  logdir=logdir,
                  host=(args.host or "0.0.0.0"),
                  port=(args.port or util.free_port()),
                  reload_interval=args.refresh_interval,
                  tensorboard_options=tensorboard_options,
                  middleware=_maybe_tb_middleware(args),
                  ready_cb=_open_cb(args),
              )
          except tensorboard.TensorboardError as e:
              cli.error(str(e))
          finally:
              log.debug("Stopping")
              monitor.stop()
              if not args.keep_logdir:
                  # Removal of temp logdir occurs when context manager
                  # exits.
                  log.debug("Removing logdir %s", logdir)
              else:
                  print(f"TensorBoard logs saved in {logdir}")
      if util.get_platform() != "Windows":
          cli.out()
  
imports: import csv
  import logging
  import os
  import re
  import sys
  import time
  from guild import batch_util
  from guild import cli
  from guild import op_util
  from guild import run_util
  from guild import tfevent
  from guild import util
  from .None import runs_impl
label_desc: Use image node_id 4 for calling a global function with example usage: _run_tensorboard(args) without return types