class_docstr: Holds a list of enqueue operations for a queue, each to be run in a thread.
  
  Queues are a convenient TensorFlow mechanism to compute tensors
  asynchronously using multiple threads. For example in the canonical 'Input
  Reader' setup one set of threads generates filenames in a queue; a second set
  of threads read records from the files, processes them, and enqueues tensors
  on a second queue; a third set of threads dequeues these input records to
  construct batches and runs them through training operations.
  
  There are several delicate issues when running multiple threads that way:
  closing the queues in sequence as the input is exhausted, correctly catching
  and reporting exceptions, etc.
  
  The `QueueRunner`, combined with the `Coordinator`, helps handle these issues.
  
  @compatibility(TF2)
  QueueRunners are not compatible with eager execution. Instead, please
  use [tf.data](https://www.tensorflow.org/guide/data) to get data into your
  model.
  @end_compatibility
class_docstr_tok: ["Holds","a","list","of","enqueue","operations","for","a","queue",",","each","to","be","run","in","a","thread",".","Queues","are","a","convenient","TensorFlow","mechanism","to","compute","tensors","asynchronously","using","multiple","threads",".","For","example","in","the","canonical","'Input","Reader","'","setup","one","set","of","threads","generates","filenames","in","a","queue",";","a","second","set","of","threads","read","records","from","the","files",",","processes","them",",","and","enqueues","tensors","on","a","second","queue",";","a","third","set","of","threads","dequeues","these","input","records","to","construct","batches","and","runs","them","through","training","operations",".","There","are","several","delicate","issues","when","running","multiple","threads","that","way",":","closing","the","queues","in","sequence","as","the","input","is","exhausted",",","correctly","catching","and","reporting","exceptions",",","etc",".","The","`","QueueRunner","`",",","combined","with","the","`","Coordinator","`",",","helps","handle","these","issues",".","@","compatibility","(","TF2",")","QueueRunners","are","not","compatible","with","eager","execution",".","Instead",",","please","use","[","tf.data","]","(","https",":","\/\/www.tensorflow.org\/guide\/data",")","to","get","data","into","your","model",".","@","end_compatibility"]
docstr: Execute the enqueue op in a loop, close the queue in case of error.
  
  Args:
    sess: A Session.
    enqueue_op: The Operation to run.
    coord: Optional Coordinator object for reporting errors and checking
      for stop conditions.
docstr_tok: ["Execute","the","enqueue","op","in","a","loop",",","close","the","queue","in","case","of","error",".","Args",":","sess",":","A","Session",".","enqueue_op",":","The","Operation","to","run",".","coord",":","Optional","Coordinator","object","for","reporting","errors","and","checking","for","stop","conditions","."]
code: def _run(self, sess, enqueue_op, coord=None):
      """Execute the enqueue op in a loop, close the queue in case of error.
  
      Args:
        sess: A Session.
        enqueue_op: The Operation to run.
        coord: Optional Coordinator object for reporting errors and checking
          for stop conditions.
      """
      decremented = False
      try:
          # Make a cached callable from the `enqueue_op` to decrease the
          # Python overhead in the queue-runner loop.
          enqueue_callable = sess.make_callable(enqueue_op)
          while True:
              if coord and coord.should_stop():
                  break
              try:
                  enqueue_callable()
              except (
                  self._queue_closed_exception_types
              ):  # pylint: disable=catching-non-exception
                  # This exception indicates that a queue was closed.
                  with self._lock:
                      self._runs_per_session[sess] -= 1
                      decremented = True
                      if self._runs_per_session[sess] == 0:
                          try:
                              sess.run(self._close_op)
                          except Exception as e:
                              # Intentionally ignore errors from close_op.
                              logging.vlog(
                                  1, "Ignored exception: %s", str(e)
                              )
                      return
      except Exception as e:
          # This catches all other exceptions.
          if coord:
              coord.request_stop(e)
          else:
              logging.error("Exception in QueueRunner: %s", str(e))
              with self._lock:
                  self._exceptions_raised.append(e)
              raise
      finally:
          # Make sure we account for all terminations: normal or errors.
          if not decremented:
              with self._lock:
                  self._runs_per_session[sess] -= 1
  
imports: import threading
  import weakref
  from tensorflow.core.protobuf import queue_runner_pb2
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 11 for calling the QueueRunner obj's underlying member method code with example usage: obj._run(sess, enqueue_op, coord) without return types