Skip to content

Commit

Permalink
make wait for server print periodic status messages and increase time…
Browse files Browse the repository at this point in the history
…out for shortfin
  • Loading branch information
renxida committed Jan 6, 2025
1 parent 1503af8 commit cb0fb73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions app_tests/integration_tests/llm/shortfin/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def llm_server(request, model_test_dir, write_config):
vmfb_path,
parameters_path,
settings,
timeout=300,
)
logger.info("LLM server started!" + end_log_group())
yield server_process, port
Expand Down
9 changes: 7 additions & 2 deletions app_tests/integration_tests/llm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,21 @@ def find_available_port():
return port


def wait_for_server(url, timeout=10):
def wait_for_server(url, timeout):
logger.info(f"Waiting for server to start at {url}...")
start = time.time()
while time.time() - start < timeout:
elapsed = 0
while elapsed <= timeout:
try:
requests.get(f"{url}/health")
logger.info("Server successfully started")
return
except requests.exceptions.ConnectionError:
logger.info(
"Server has not started yet; waited {elapsed} seconds, giving up in timeout: {timeout} seconds."
)
time.sleep(1)
elapsed = time.time() - start
raise TimeoutError(f"Server did not start within {timeout} seconds at {url}")


Expand Down

0 comments on commit cb0fb73

Please sign in to comment.