From ecc6855e4923a99a78d67ac76490d35e90143334 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 31 Jan 2024 10:58:25 -0800 Subject: [PATCH] build(config.yml): add more logging for docker build and test --- .circleci/config.yml | 2 +- tests/test_keys.py | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5392d820a..d155823c6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -156,7 +156,7 @@ jobs: --config /app/config.yaml \ --port 4000 \ --num_workers 8 \ - --debug \ + --detailed_debug \ --run_gunicorn \ - run: name: Install curl and dockerize diff --git a/tests/test_keys.py b/tests/test_keys.py index fb665fccf..a3bd3f0c6 100644 --- a/tests/test_keys.py +++ b/tests/test_keys.py @@ -107,19 +107,23 @@ async def chat_completion(session, key, model="gpt-4"): ], } - async with session.post(url, headers=headers, json=data) as response: - status = response.status - response_text = await response.text() + for i in range(3): + try: + async with session.post(url, headers=headers, json=data) as response: + status = response.status + response_text = await response.text() - print(response_text) - print() + print(response_text) + print() - if status != 200: - raise Exception( - f"Request did not return a 200 status code: {status}. Response: {response_text}" - ) + if status != 200: + raise Exception( + f"Request did not return a 200 status code: {status}. Response: {response_text}" + ) - return await response.json() + return await response.json() + except: + pass async def chat_completion_streaming(session, key, model="gpt-4"):