Change TaskHandler.close() wait default to False as it should not wait for logs to flush

This commit is contained in:
allegroai 2020-04-09 12:39:09 +03:00
parent b3c9872a3f
commit 98ce0bbe43
3 changed files with 3 additions and 11 deletions

View File

@ -153,7 +153,7 @@ class TaskHandler(BufferingHandler):
self.release()
ll(msg % 11)
def close(self, wait=True):
def close(self, wait=False):
# super already calls self.flush()
super(TaskHandler, self).close()
# shut down the TaskHandler, from this point onwards. No events will be logged
@ -168,7 +168,7 @@ class TaskHandler(BufferingHandler):
def _send_events(self, a_request):
try:
if self._thread_pool is None:
self.__log_stderr('WARNING: trains.Task - '
self.__log_stderr('INFO: trains.Task - '
'Task.close() flushing remaining logs ({})'.format(self._pending))
self._pending -= 1
res = self.session.send(a_request)

View File

@ -723,11 +723,7 @@ class Logger(object):
)
def _start_task_if_needed(self):
# do not refresh the task status read from cached variable _status
# if str(self._task._status) == str(tasks.TaskStatusEnum.created):
# self._task.mark_started()
#
# self._task._dev_mode_task_start()
# deprecated
pass
def _flush_stdout_handler(self):

View File

@ -770,8 +770,6 @@ class Task(_Task):
# store is main before we call at_exit, because will will Null it
is_main = self.is_main_task()
self._at_exit()
# leave _at_exit_called set to True (I think)
## self._at_exit_called = False
# unregister atexit callbacks and signal hooks, if we are the main task
if is_main:
self.__register_at_exit(None)
@ -1582,8 +1580,6 @@ class Task(_Task):
except Exception:
pass
self._edit_lock = None
# HACK FOR TRACE
self.is_main_task()
@classmethod
def __register_at_exit(cls, exit_callback, only_remove_signal_and_exception_hooks=False):