Retry sending console logs if session.send() fails (applicable only in local mode where we use the logging handler)

This commit is contained in:
allegroai 2020-02-26 17:07:07 +02:00
parent cf850020fb
commit 8ee2bd1844

View File

@ -128,5 +128,7 @@ class TaskHandler(BufferingHandler):
res = self.session.send(a_request)
if not res.ok():
print("Failed logging task to backend ({:d} lines, {})".format(len(a_request.requests), str(res.meta)))
except Exception:
print("Failed logging task to backend ({:d} lines)".format(len(a_request.requests)))
except Exception as ex:
print("Retrying, failed logging task to backend ({:d} lines): {}".format(len(a_request.requests), ex))
# we should push ourselves back into the thread pool
self._thread_pool.apply_async(self._send_events, args=(a_request, ))