diff --git a/visualdl/writer/record_writer.py b/visualdl/writer/record_writer.py index e80e0ff903ad8913c121a1149e27ea898e79009a..01ea1ad442a39497513b3822614067be6e04af36 100644 --- a/visualdl/writer/record_writer.py +++ b/visualdl/writer/record_writer.py @@ -21,6 +21,9 @@ import struct import time import queue import threading +import os + +QUEUE_TIMEOUT = os.getenv("VDL_QUEUE_TIMEOUT") class RecordWriter(object): @@ -145,7 +148,10 @@ class _AsyncWriter(object): with self._lock: if self._closed: raise IOError("Writer is closed.") - self._bytes_queue.put(bytestring) + try: + self._bytes_queue.put(bytestring, timeout=QUEUE_TIMEOUT) + except queue.Full: + print('This data was not written to the log due to timeout.') def flush(self): with self._lock: