MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / queue_put_stoppable

Method queue_put_stoppable

tensorpack/utils/concurrency.py:54–61  ·  view source on GitHub ↗

Put obj to queue, but will give up when the thread is stopped

(self, q, obj)

Source from the content-addressed store, hash-verified

52 return self._stop_evt.isSet()
53
54 def queue_put_stoppable(self, q, obj):
55 """ Put obj to queue, but will give up when the thread is stopped"""
56 while not self.stopped():
57 try:
58 q.put(obj, timeout=5)
59 break
60 except queue.Full:
61 pass
62
63 def queue_get_stoppable(self, q):
64 """ Take obj from queue, but will give up when the thread is stopped"""

Callers 4

runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 2

stoppedMethod · 0.95
putMethod · 0.80

Tested by

no test coverage detected