X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c830768910678af42a92d8d0b63ac96d5636361c..b9b4502bcddeccd794614bf6979d643f9f350877:/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 afa53ae73c..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.sort_stats('time').print_stats() - if caught: - raise - return ret + return function(*args, **kwargs) + finally: + pr.disable() + ps = pstats.Stats(pr, stream=outfile) + ps.sort_stats('time').print_stats() return profiled_function