class_docstr: This class manages the *InputMode.SPARK* data feeding process from the perspective of the TensorFlow application.
  
  Args:
    :mgr: TFManager instance associated with this Python worker process.
    :train_mode: boolean indicating if the data feed is expecting an output response (e.g. inferencing).
    :qname_in: *INTERNAL_USE*
    :qname_out: *INTERNAL_USE*
    :input_mapping: *For Spark ML Pipelines only*.  Dictionary of input DataFrame columns to input TensorFlow tensors.
class_docstr_tok: ["This","class","manages","the","*","InputMode.SPARK","*","data","feeding","process","from","the","perspective","of","the","TensorFlow","application",".","Args",":",":","mgr",":","TFManager","instance","associated","with","this","Python","worker","process",".",":","train_mode",":","boolean","indicating","if","the","data","feed","is","expecting","an","output","response","(","e.g",".","inferencing",")",".",":","qname_in",":","*","INTERNAL_USE","*",":","qname_out",":","*","INTERNAL_USE","*",":","input_mapping",":","*","For","Spark","ML","Pipelines","only","*",".","Dictionary","of","input","DataFrame","columns","to","input","TensorFlow","tensors","."]
docstr: Terminate data feeding early.
  
  Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
  this method signals the data feeding process to ignore any further incoming data.  Note that Spark itself does not have a mechanism
  to terminate an RDD operation early, so the extra partitions will still be sent to the executors (but will be ignored).  Because
  of this, you should size your input data accordingly to avoid excessive overhead.
docstr_tok: ["Terminate","data","feeding","early",".","Since","TensorFlow","applications","can","often","terminate","on","conditions","unrelated","to","the","training","data","(","e.g",".","steps",",","accuracy",",","etc",")",",","this","method","signals","the","data","feeding","process","to","ignore","any","further","incoming","data",".","Note","that","Spark","itself","does","not","have","a","mechanism","to","terminate","an","RDD","operation","early",",","so","the","extra","partitions","will","still","be","sent","to","the","executors","(","but","will","be","ignored",")",".","Because","of","this",",","you","should","size","your","input","data","accordingly","to","avoid","excessive","overhead","."]
code: def terminate(self):
      """Terminate data feeding early.
  
      Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
      this method signals the data feeding process to ignore any further incoming data.  Note that Spark itself does not have a mechanism
      to terminate an RDD operation early, so the extra partitions will still be sent to the executors (but will be ignored).  Because
      of this, you should size your input data accordingly to avoid excessive overhead.
      """
      logger.info("terminate() invoked")
      self.mgr.set("state", "terminating")
  
      # drop remaining items in the queue
      queue = self.mgr.get_queue(self.qname_in)
      count = 0
      done = False
      while not done:
          try:
              queue.get(block=True, timeout=5)
              queue.task_done()
              count += 1
          except Empty:
              logger.info("dropped {0} items from queue".format(count))
              done = True
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import nested_scopes
  from __future__ import print_function
  import getpass
  import logging
  import pkg_resources
  from packaging import version
  from six.moves.queue import Empty
  from .None import compat, marker
label_desc: Use image node_id 5 for calling the DataFeed obj's underlying member method code with example usage: obj.terminate() without return types