[Misc] Manage HTTP connections in one place (#6600)

This commit is contained in:
Cyrus Leung
2024-07-23 12:32:02 +08:00
committed by GitHub
parent c051bfe4eb
commit 97234be0ec
7 changed files with 215 additions and 85 deletions

View File

@@ -16,6 +16,7 @@ import requests
import torch
import vllm.envs as envs
from vllm.connections import global_http_connection
from vllm.version import __version__ as VLLM_VERSION
_config_home = envs.VLLM_CONFIG_ROOT
@@ -204,7 +205,8 @@ class UsageMessage:
def _send_to_server(self, data):
try:
requests.post(_USAGE_STATS_SERVER, json=data)
global_http_client = global_http_connection.get_sync_client()
global_http_client.post(_USAGE_STATS_SERVER, json=data)
except requests.exceptions.RequestException:
# silently ignore unless we are using debug log
logging.debug("Failed to send usage data to server")