Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: delete broken wait_for helper #8312

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 4 additions & 17 deletions e2e_tests/tests/cluster/test_rbac_ntsc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import contextlib
from typing import Generator, List, Optional, Sequence, Tuple
from typing import Generator, List, Optional, Sequence

import pytest

Expand Down Expand Up @@ -417,22 +417,9 @@ def test_tsb_launch_on_trials() -> None:
["--project_id", str(pid)],
)

def get_exp_trials() -> Tuple[bool, List[int]]:
trial_ids: List[int] = []
try:
trials = bindings.get_GetExperimentTrials(
session,
experimentId=experiment_id,
).trials
trial_ids = [t.id for t in trials]
except errors.APIException:
return False, []
if len(trial_ids) > 0:
return True, trial_ids
return False, []

trial_ids: List[int] = utils.wait_for(get_exp_trials, conf.DEFAULT_MAX_WAIT_SECS)
assert len(trial_ids) == 1, f"we should get 1 trials {trial_ids}"
trials = bindings.get_GetExperimentTrials(session, experimentId=experiment_id).trials
trial_ids = [t.id for t in trials]
assert len(trial_ids) == 1, f"we should have 1 trial, but got {trial_ids}"

bindings.post_LaunchTensorboard(
session,
Expand Down
20 changes: 1 addition & 19 deletions e2e_tests/tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
import time
from typing import Any, Callable, Tuple, TypeVar
from typing import Any

from determined.common.api import authentication
from tests import config as conf

T = TypeVar("T")


def wait_for(predicate: Callable[[], Tuple[bool, T]], timeout: int) -> T:
"""
Wait for the predicate to return (Done, ReturnValue) while
checking for a timeout. without preempting the predicate.
"""

start = time.time()
done, rv = predicate()
while not done:
if time.time() - start > timeout:
raise TimeoutError("timed out waiting for predicate")
time.sleep(0.1)
return rv


class CliArgsMock:
"""Mock the CLI args to mimic invoking the CLI with the given args."""
Expand Down