Fix core.threading.wrapper
This commit is contained in:
parent
b662d8797e
commit
a6810840ae
@ -2,6 +2,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import threading
|
||||||
|
|
||||||
timer = time.perf_counter if hasattr(time, "perf_counter") else time.clock
|
timer = time.perf_counter if hasattr(time, "perf_counter") else time.clock
|
||||||
|
|
||||||
@ -16,12 +17,12 @@ class ExceptionWrapper(Wrapper):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
try:
|
try:
|
||||||
self.workload()
|
self.workload()
|
||||||
except BaseException as exc:
|
except:
|
||||||
sys.stderr.write("Exception in {thread} at {time}\n".format(
|
sys.stderr.write("Exception in {thread} at {time}\n".format(
|
||||||
thread=threading.current_thread().name,
|
thread=threading.current_thread().name,
|
||||||
time=time.strftime("%c")
|
time=time.strftime("%c")
|
||||||
))
|
))
|
||||||
traceback.print_exception(*sys.exc_info(), file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
class WorkloadWrapper(Wrapper):
|
class WorkloadWrapper(Wrapper):
|
||||||
|
Loading…
Reference in New Issue
Block a user