Fix logs, events and jupyter flushing on exit

This commit is contained in:
allegroai
2020-01-21 16:41:01 +02:00
parent f0a27127bf
commit 1cc0ea6cf3
6 changed files with 46 additions and 3 deletions

View File

@@ -113,6 +113,16 @@ class TaskHandler(BufferingHandler):
if batch_requests:
self._thread_pool.apply_async(self._send_events, args=(batch_requests, ))
def wait_for_flush(self):
self.acquire()
try:
self._thread_pool.close()
self._thread_pool.join()
except Exception:
pass
self._thread_pool = ThreadPool(processes=1)
self.release()
def _send_events(self, a_request):
try:
res = self.session.send(a_request)