Skip to content

Commit

Permalink
'v2.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
smasky committed Oct 15, 2024
1 parent 5700bdb commit 0572eb6
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions UQPyL/utility/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0572eb6

Please sign in to comment.