Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tests/test_ote_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import glob
import io
import os
import os.path as osp
import random
import time
Expand Down Expand Up @@ -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.')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 @aiarkinx : I propose to do as follows

if os.getenv("CUDA_VISIBLE_DEVICES") == "":
    timeout = 400
else:
    timeout = 100

self.assertLess(time.time() - start_time, timeout, f'Expected to stop within {timeout} seconds.')

(please, do not move complicated code inside if - then - else clause if it is possible to move only one variable into it.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


# Test stopping immediately (as soon as training is started).
start_time = time.time()
Expand All @@ -232,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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the same changes related timeout variable as I wrote above


@e2e_pytest_api
def test_training_progress_tracking(self):
Expand Down