server : (tests) don't use thread for capturing stdout/stderr, bump openai client library (#10568)

* server : (tests) don't use thread for capturing stdout/stderr

* test: bump openai to 1.55.2

* bump openai to 1.55.3
This commit is contained in:
Xuan Son Nguyen 2024-11-28 19:17:49 +01:00 committed by GitHub
parent 890719311b
commit 6c59567689
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 18 deletions

View File

@ -2,6 +2,6 @@ aiohttp~=3.9.3
pytest~=8.3.3 pytest~=8.3.3
huggingface_hub~=0.23.2 huggingface_hub~=0.23.2
numpy~=1.26.4 numpy~=1.26.4
openai~=1.30.3 openai~=1.55.3
prometheus-client~=0.20.0 prometheus-client~=0.20.0
requests~=2.32.3 requests~=2.32.3

View File

@ -8,7 +8,6 @@ import os
import re import re
import json import json
import sys import sys
import threading
import requests import requests
import time import time
from concurrent.futures import ThreadPoolExecutor, as_completed from concurrent.futures import ThreadPoolExecutor, as_completed
@ -161,26 +160,12 @@ class ServerProcess:
self.process = subprocess.Popen( self.process = subprocess.Popen(
[str(arg) for arg in [server_path, *server_args]], [str(arg) for arg in [server_path, *server_args]],
creationflags=flags, creationflags=flags,
stdout=subprocess.PIPE, stdout=sys.stdout,
stderr=subprocess.PIPE, stderr=sys.stdout,
env={**os.environ, "LLAMA_CACHE": "tmp"}, env={**os.environ, "LLAMA_CACHE": "tmp"},
) )
server_instances.add(self) server_instances.add(self)
def server_log(in_stream, out_stream):
for line in iter(in_stream.readline, b""):
print(line.decode("utf-8"), end="", file=out_stream)
thread_stdout = threading.Thread(
target=server_log, args=(self.process.stdout, sys.stdout), daemon=True
)
thread_stdout.start()
thread_stderr = threading.Thread(
target=server_log, args=(self.process.stderr, sys.stderr), daemon=True
)
thread_stderr.start()
print(f"server pid={self.process.pid}, pytest pid={os.getpid()}") print(f"server pid={self.process.pid}, pytest pid={os.getpid()}")
# wait for server to start # wait for server to start