diff --git a/UQPyL/utility/verbose.py b/UQPyL/utility/verbose.py index 4591bb04..179d659d 100644 --- a/UQPyL/utility/verbose.py +++ b/UQPyL/utility/verbose.py @@ -18,8 +18,9 @@ class Verbose(): saveFlag=False verbose=False workDir=os.getcwd() - IterEmit=None - VerboseEmit=None + iterEmit=None + verboseEmit=None + isStop=False total_width=os.get_terminal_size().columns @staticmethod def output(obj): @@ -28,9 +29,15 @@ def output(obj): obj=str(obj)+'\n' if Verbose.logFlag: + Verbose.logLines.append(obj) + if Verbose.verboseEmit: + + Verbose.verboseEmit.send(obj) + if Verbose.verbose: + print(obj) @staticmethod @@ -127,6 +134,10 @@ def decoratorRecord(func): @functools.wraps(func) def wrapper(obj, *args, **kwargs): + if Verbose.iterEmit: + + Verbose.iterEmit.send() + func(obj, *args, **kwargs) if obj.verbose and obj.iters%obj.verboseFreq==0: @@ -230,6 +241,11 @@ def wrapper(obj, *args, **kwargs): table.add_row(values) Verbose.output(table) + #TODO + if Verbose.iterEmit: + + Verbose.iterEmit.send() + startTime=time.time() res=func(obj, *args, **kwargs) endTime=time.time() @@ -257,6 +273,13 @@ def wrapper(obj, *args, **kwargs): Verbose.saveLog(obj, folder_log) + #TODO + if Verbose.isStop: + Verbose.iterEmit.unfinished() + else: + Verbose.iterEmit.finished() + + Verbose.logFlag, Verbose.verbose, Verbose.saveFlag=record return res