X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/46a6199f3a40a24ee145adc390500190b17a6395..f54096601d61d3d3016317c4b80b3e1a701af869:/sdk/python/tests/performance/performance_profiler.py diff --git a/sdk/python/tests/performance/performance_profiler.py b/sdk/python/tests/performance/performance_profiler.py index a36ce254dd..50eadd1dd9 100644 --- a/sdk/python/tests/performance/performance_profiler.py +++ b/sdk/python/tests/performance/performance_profiler.py @@ -37,13 +37,9 @@ def profiled(function): pr = profile.Profile() pr.enable() try: - ret = function(*args, **kwargs) - except Exception as e: - caught = e - pr.disable() - ps = pstats.Stats(pr, stream=outfile) - ps.print_stats() - if caught: - raise caught - return ret + return function(*args, **kwargs) + finally: + pr.disable() + ps = pstats.Stats(pr, stream=outfile) + ps.sort_stats('time').print_stats() return profiled_function