added per job time statistics to JM client

This commit is contained in:
Richard Hartmann 2016-01-27 15:20:36 +01:00
parent a3542b7f6c
commit f633e7c550
2 changed files with 19 additions and 19 deletions

View file

@ -396,7 +396,7 @@ class JobManager_Client(object):
# regular case, just stop working when empty job_q was found # regular case, just stop working when empty job_q was found
except queue.Empty: except queue.Empty:
if verbose > 1: if verbose > 0:
print("{}: finds empty job queue, processed {} jobs".format(identifier, cnt)) print("{}: finds empty job queue, processed {} jobs".format(identifier, cnt))
break break
# handle SystemExit in outer try ... except # handle SystemExit in outer try ... except
@ -511,7 +511,7 @@ class JobManager_Client(object):
if verbose > 0: if verbose > 0:
try: try:
print("{}: pure calculation time: {}".format(identifier, progress.humanize_time(time_calc) )) print("{}: pure calculation time: {} single task average: {}".format(identifier, progress.humanize_time(time_calc), progress.humanize_time(time_calc / cnt) ))
print("{}: calculation:{:.2%} communication:{:.2%}".format(identifier, time_calc/(time_calc+time_queue), time_queue/(time_calc+time_queue))) print("{}: calculation:{:.2%} communication:{:.2%}".format(identifier, time_calc/(time_calc+time_queue), time_queue/(time_calc+time_queue)))
except: except:
pass pass
@ -607,7 +607,7 @@ class JobManager_Client(object):
while p.is_alive(): while p.is_alive():
if self.verbose > 2: if self.verbose > 2:
print("{}: still alive {} PID {}".format(self._identifier, p, p.pid)) print("{}: still alive {} PID {}".format(self._identifier, p, p.pid))
p.join(timeout=1) p.join(timeout=self.interval)
if self.verbose > 2: if self.verbose > 2:
print("{}: process {} PID {} was joined".format(self._identifier, p, p.pid)) print("{}: process {} PID {} was joined".format(self._identifier, p, p.pid))
@ -1528,12 +1528,12 @@ def proxy_operation_decorator_python3(proxy, operation, verbose=1, identifier=''
res = o(*args, **kwargs) res = o(*args, **kwargs)
except Exception as e: except Exception as e:
if verbose > 0: if verbose > 1:
print("{}operation '{}' -> {} FAILED due to '{}'".format(identifier, operation, dest, type(e))) print("{}operation '{}' -> {} FAILED due to '{}'".format(identifier, operation, dest, type(e)))
print(traceback.format_stack()[-3].strip()) print(traceback.format_stack()[-3].strip())
if type(e) is ConnectionResetError: if type(e) is ConnectionResetError:
if verbose > 0: if verbose > 1:
traceback.print_exc(limit=1) traceback.print_exc(limit=1)
print("{}try to reconnect".format(identifier)) print("{}try to reconnect".format(identifier))
call_connect(proxy._connect, dest, verbose, identifier, reconnect_wait, reconnect_tries) call_connect(proxy._connect, dest, verbose, identifier, reconnect_wait, reconnect_tries)

View file

@ -883,22 +883,22 @@ if __name__ == "__main__":
pass pass
else: else:
func = [ func = [
test_Signal_to_SIG_IGN, # test_Signal_to_SIG_IGN,
test_Signal_to_sys_exit, # test_Signal_to_sys_exit,
test_Signal_to_terminate_process_list, # test_Signal_to_terminate_process_list,
test_jobmanager_basic, # test_jobmanager_basic,
test_jobmanager_server_signals, # test_jobmanager_server_signals,
test_shutdown_server_while_client_running, # test_shutdown_server_while_client_running,
test_shutdown_client, # test_shutdown_client,
test_check_fail, # test_check_fail,
test_jobmanager_read_old_stat, # test_jobmanager_read_old_stat,
test_client_status, test_client_status,
test_jobmanager_local, # test_jobmanager_local,
test_start_server_on_used_port, # test_start_server_on_used_port,
test_shared_const_arg, # test_shared_const_arg,
test_digest_rejected, # test_digest_rejected,
test_exception, # test_exception,
lambda : print("END") lambda : print("END")
] ]