adding some debug to client

This commit is contained in:
Adolfo Gómez García 2021-06-21 17:11:32 +02:00
parent 1abe95c492
commit 25fec929a9
2 changed files with 10 additions and 8 deletions

View File

@ -192,21 +192,22 @@ def endScript():
try:
logger.debug('Wating for tasks to finish...')
tools.waitForTasks()
except Exception:
pass
except Exception as e:
logger.debug('Watiting for tasks to finish: %s', e)
try:
logger.debug('Unlinking files')
tools.unlinkFiles()
except Exception:
pass
except Exception as e:
logger.debug('Unlinking files: %s', e)
# Removing
try:
logger.debug('Executing threads before exit')
tools.execBeforeExit()
except Exception:
pass
except Exception as e:
logger.debug('execBeforeExit: %s', e)
logger.debug('endScript done')

View File

@ -157,6 +157,7 @@ def addTaskToWait(taks: typing.Any, includeSubprocess: bool = False) -> None:
def waitForTasks() -> None:
logger.debug('Started to wait %s', _tasksToWait)
for task, waitForSubp in _tasksToWait:
logger.debug('Waiting for task %s, subprocess wait: %s', task, waitForSubp)
try:
@ -170,8 +171,8 @@ def waitForTasks() -> None:
for i in filter(lambda x: x.ppid() == task.pid, psutil.process_iter(attrs=('ppid',))):
logger.debug('Found %s', i)
i.wait()
except Exception:
pass
except Exception as e:
logger.error('Waiting for tasks to finish error: %s', e)
def addExecBeforeExit(fnc: typing.Callable[[], None]) -> None: