MCPcopy
hub / github.com/tornadoweb/tornado / task_done

Method task_done

tornado/queues.py:274–290  ·  view source on GitHub ↗

Indicate that a formerly enqueued task is complete. Used by queue consumers. For each `.get` used to fetch a task, a subsequent call to `.task_done` tells the queue that the processing on the task is complete. If a `.join` is blocking, it resumes when all items have

(self)

Source from the content-addressed store, hash-verified

272 raise QueueEmpty
273
274 def task_done(self) -> None:
275 """Indicate that a formerly enqueued task is complete.
276
277 Used by queue consumers. For each `.get` used to fetch a task, a
278 subsequent call to `.task_done` tells the queue that the processing
279 on the task is complete.
280
281 If a `.join` is blocking, it resumes when all items have been
282 processed; that is, when every `.put` is matched by a `.task_done`.
283
284 Raises `ValueError` if called more times than `.put`.
285 """
286 if self._unfinished_tasks <= 0:
287 raise ValueError("task_done() called too many times")
288 self._unfinished_tasks -= 1
289 if self._unfinished_tasks == 0:
290 self._finished.set()
291
292 def join(
293 self, timeout: Optional[Union[float, datetime.timedelta]] = None

Callers 4

workerMethod · 0.80
test_task_done_delayMethod · 0.80
consumerMethod · 0.80
workerFunction · 0.80

Calls 1

setMethod · 0.45

Tested by 3

workerMethod · 0.64
test_task_done_delayMethod · 0.64
consumerMethod · 0.64