mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-07 13:07:22 +00:00
[ISSUE-5522] Fix profiler timeout (#6448)
* ChangeIsFunction by IsMethod * Update test * Remove whitespace
This commit is contained in:
parent
c4e88b69fa
commit
512b241069
@ -65,7 +65,7 @@ def cls_timeout(seconds: int = TEN_MIN):
|
||||
"""
|
||||
|
||||
def inner(cls):
|
||||
for attr_name, attr in inspect.getmembers(cls, inspect.isfunction):
|
||||
for attr_name, attr in inspect.getmembers(cls, inspect.ismethod):
|
||||
setattr(cls, attr_name, timeout(seconds)(getattr(cls, attr_name)))
|
||||
|
||||
return cls
|
||||
|
||||
@ -43,13 +43,11 @@ class Timer:
|
||||
Helper to test timeouts
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def slow():
|
||||
def slow(self):
|
||||
time.sleep(10)
|
||||
return 1
|
||||
|
||||
@staticmethod
|
||||
def fast():
|
||||
def fast(self):
|
||||
return 1
|
||||
|
||||
|
||||
@ -65,7 +63,6 @@ class RunnerTest(TestCase):
|
||||
sample = sampler.random_sample()
|
||||
|
||||
raw_runner = QueryRunner(session=session, table=User, sample=sample)
|
||||
|
||||
timeout_runner: Timer = cls_timeout(1)(Timer())
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user