X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/465cb9225cce74600349239a295b1360ce2b0fa6..b9b4502bcddeccd794614bf6979d643f9f350877:/sdk/python/tests/performance/performance_profiler.py?ds=sidebyside 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