From b7ddf1b152203e9560f97e803537271d282d3aeb Mon Sep 17 00:00:00 2001 From: aiarkinx Date: Tue, 14 Dec 2021 16:22:44 +0300 Subject: [PATCH 1/3] test_cancel_training_detection --- tests/test_ote_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_ote_api.py b/tests/test_ote_api.py index 77c19342405..373220aeb8e 100644 --- a/tests/test_ote_api.py +++ b/tests/test_ote_api.py @@ -14,6 +14,7 @@ import glob import io +import os import os.path as osp import random import time @@ -222,7 +223,10 @@ def progress_callback(progress: float, score: Optional[float] = None): # stopping process has to happen in less than 35 seconds train_future.result() self.assertEqual(training_progress_curve[-1], 100) - self.assertLess(time.time() - start_time, 100, 'Expected to stop within 100 seconds.') + if os.getenv("CUDA_VISIBLE_DEVICES") == "": + self.assertLess(time.time() - start_time, 400, 'Expected to stop within 400 seconds.') + else: + self.assertLess(time.time() - start_time, 100, 'Expected to stop within 100 seconds.') # Test stopping immediately (as soon as training is started). start_time = time.time() From dbd7c11704b7a19bd46d2deb02dd752128a0c24a Mon Sep 17 00:00:00 2001 From: aiarkinx Date: Wed, 15 Dec 2021 14:03:41 +0300 Subject: [PATCH 2/3] fix stopped part --- tests/test_ote_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_ote_api.py b/tests/test_ote_api.py index 373220aeb8e..29e77546efb 100644 --- a/tests/test_ote_api.py +++ b/tests/test_ote_api.py @@ -236,7 +236,10 @@ def progress_callback(progress: float, score: Optional[float] = None): detection_task.cancel_training() train_future.result() - self.assertLess(time.time() - start_time, 25) # stopping process has to happen in less than 25 seconds + if os.getenv("CUDA_VISIBLE_DEVICES") == "": + self.assertLess(time.time() - start_time, 400) + else: + self.assertLess(time.time() - start_time, 25) # stopping process has to happen in less than 25 seconds @e2e_pytest_api def test_training_progress_tracking(self): From 58775813a87c3d677da147edbe1413a31738aec6 Mon Sep 17 00:00:00 2001 From: aiarkinx Date: Mon, 20 Dec 2021 16:17:04 +0300 Subject: [PATCH 3/3] refactoring condition style --- tests/test_ote_api.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_ote_api.py b/tests/test_ote_api.py index 29e77546efb..43ddc3e649f 100644 --- a/tests/test_ote_api.py +++ b/tests/test_ote_api.py @@ -224,9 +224,10 @@ def progress_callback(progress: float, score: Optional[float] = None): train_future.result() self.assertEqual(training_progress_curve[-1], 100) if os.getenv("CUDA_VISIBLE_DEVICES") == "": - self.assertLess(time.time() - start_time, 400, 'Expected to stop within 400 seconds.') + stop_timeout = 400 else: - self.assertLess(time.time() - start_time, 100, 'Expected to stop within 100 seconds.') + stop_timeout = 100 + self.assertLess(time.time() - start_time, stop_timeout, f'Expected to stop within {stop_timeout} seconds.') # Test stopping immediately (as soon as training is started). start_time = time.time() @@ -237,9 +238,11 @@ def progress_callback(progress: float, score: Optional[float] = None): train_future.result() if os.getenv("CUDA_VISIBLE_DEVICES") == "": - self.assertLess(time.time() - start_time, 400) + stop_process_timeout = 400 else: - self.assertLess(time.time() - start_time, 25) # stopping process has to happen in less than 25 seconds + stop_process_timeout = 25 + self.assertLess(time.time() - start_time, stop_process_timeout, f'Expected to stop within {stop_process_timeout} seconds.') + @e2e_pytest_api def test_training_progress_tracking(self):