class_docstr: A thread-safe task queue with duplicate detection.
  
  The life-cycle of a task starts with producers calling `enqueue`. Consumers
  call `dequeue` to obtain the tasks in FIFO order. When processing is complete,
  consumers must release the tasks by calling `task_done`.
class_docstr_tok: ["A","thread-safe","task","queue","with","duplicate","detection",".","The","life-cycle","of","a","task","starts","with","producers","calling","`","enqueue","`",".","Consumers","call","`","dequeue","`","to","obtain","the","tasks","in","FIFO","order",".","When","processing","is","complete",",","consumers","must","release","the","tasks","by","calling","`","task_done","`","."]
docstr: Enqueues the given task if no prior task with the same id exists.
  
  Args:
    task: A `Task` object.
  
  Returns:
    `True` if the task could be enqueued. `False` if a task with the same id
    already exists.
docstr_tok: ["Enqueues","the","given","task","if","no","prior","task","with","the","same","id","exists",".","Args",":","task",":","A","`","Task","`","object",".","Returns",":","`","True","`","if","the","task","could","be","enqueued",".","`","False","`","if","a","task","with","the","same","id","already","exists","."]
code: def enqueue(self, task: task_lib.Task) -> bool:
      """Enqueues the given task if no prior task with the same id exists.
  
      Args:
        task: A `Task` object.
  
      Returns:
        `True` if the task could be enqueued. `False` if a task with the same id
        already exists.
      """
      task_id = task.task_id
      with self._lock:
          if task_id in self._task_ids:
              return False
          self._task_ids.add(task_id)
          self._queue.put((task_id, task))
      return True
  
file_path: tfx/tfx/orchestration/experimental/core/task_queue.py
imports: import queue
  import threading
  from typing import Optional
  from tfx.orchestration.experimental.core import task
label_desc: Use image node_id 2 for calling the TaskQueue obj's underlying member method code with example usage: obj.enqueue(task) and returns: True, False