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

fix: fix flaky generic task pause test #9962

Merged
merged 4 commits into from
Sep 20, 2024
Merged
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
13 changes: 11 additions & 2 deletions e2e_tests/tests/task/test_generic_tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import time

from determined.cli import ntsc
from determined.common import util
Expand Down Expand Up @@ -231,8 +232,16 @@ def test_pause_and_unpause_generic_task() -> None:

detproc.check_call(sess, command)

pause_resp = bindings.get_GetTask(sess, taskId=task_resp.taskId)
assert pause_resp.task.taskState == bindings.v1GenericTaskState.PAUSED
# The task may still be PAUSING, retry a few times.
retries = 5
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We could use task.wait_for_task_state(), but this solution is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh didn't see this, great! thanks!

for i in range(retries):
pause_resp = bindings.get_GetTask(sess, taskId=task_resp.taskId)
if pause_resp.task.taskState == bindings.v1GenericTaskState.PAUSED:
break
time.sleep(1)
else:
pytest.fail(f"Task {task_resp.taskId} did not reach a PAUSED state after {retries} seconds.")


# Unpause task
command = ["det", "-m", conf.make_master_url(), "task", "unpause", task_resp.taskId]
Expand Down
Loading