class_docstr: Consume tfevents from a priority queue.
  
  There should always only be one of these per run_manager.  We wait for 10 seconds of
  queued events to reduce the chance of multiple tfevent files triggering out of order
  steps.
class_docstr_tok: ["Consume","tfevents","from","a","priority","queue",".","There","should","always","only","be","one","of","these","per","run_manager",".","We","wait","for","10","seconds","of","queued","events","to","reduce","the","chance","of","multiple","tfevent","files","triggering","out","of","order","steps","."]
code: def __init__(
      self,
      tbwatcher: TBWatcher,
      queue: "PriorityQueue",
      run_proto: "RunRecord",
      settings: "SettingsStatic",
      delay: int = 10,
  ) -> None:
      self._tbwatcher = tbwatcher
      self._queue = queue
      self._thread = threading.Thread(target=self._thread_except_body)
      self._shutdown = threading.Event()
      self.tb_history = TBHistory()
      self._delay = delay
  
      # This is a bit of a hack to get file saving to work as it does in the user
      # process. Since we don't have a real run object, we have to define the
      # datatypes callback ourselves.
      def datatypes_cb(fname: GlobStr) -> None:
          files: FilesDict = dict(files=[(fname, "now")])
          self._tbwatcher._interface.publish_files(files)
  
      # this is only used for logging artifacts
      self._internal_run = internal_run.InternalRun(
          run_proto, settings, datatypes_cb
      )
      self._internal_run._set_internal_run_interface(
          self._tbwatcher._interface
      )
  
imports: import glob
  import logging
  import os
  import queue
  import socket
  import sys
  import threading
  import time
  from typing import TYPE_CHECKING, Any, Dict, List, Optional
  import wandb
  from wandb import util
  from wandb.sdk.interface.interface import GlobStr
  from wandb.sdk.lib import filesystem
  from wandb.viz import CustomChart
  from .None import run
label_desc: Use image node_id 1 to create a new TBEventConsumer object  with example: obj = TBEventConsumer(tbwatcher, queue, run_proto, settings, delay)