Skip to content

Commit

Permalink
Fix: Polling should stop when terminal state is reached. (#301)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vossen <[email protected]>
Co-authored-by: Tim Vossen <[email protected]>
  • Loading branch information
upwards-gravity and upwards-gravity authored Sep 27, 2023
1 parent fcee3d0 commit 901bcd4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opensearch_py_ml/ml_commons/ml_commons_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def _send_model_info(self, model_meta_json: dict):
)
end = time.time() + TIMEOUT # timeout seconds
task_flag = False
while not task_flag or time.time() < end:
while not task_flag and time.time() < end:
time.sleep(1)
status = self._get_task_info(output["task_id"])
if status["state"] != "CREATED":
Expand Down Expand Up @@ -375,7 +375,7 @@ def get_task_info(self, task_id: str, wait_until_task_done: bool = False) -> obj
if wait_until_task_done:
end = time.time() + TIMEOUT # timeout seconds
task_flag = False
while not task_flag or time.time() < end:
while not task_flag and time.time() < end:
time.sleep(1)
output = self._get_task_info(task_id)
if (
Expand Down

0 comments on commit 901bcd4

Please sign in to comment.