X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/45f10d80d1b584808a6e375214b5be6bc7d2a730..0f644e242ef37c911ad3dc25aca8135c339de349:/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..3be00c4546 100644 --- a/sdk/python/tests/performance/performance_profiler.py +++ b/sdk/python/tests/performance/performance_profiler.py @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + # Use the "profiled" decorator on a test to get profiling data. # # Usage: @@ -37,13 +41,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