server: remove warmup methods everywhere

This commit is contained in:
2023-10-05 23:44:50 +02:00
committed by Mathieu Virbel
parent 50b89ecdda
commit 47f7e1836e
11 changed files with 2 additions and 134 deletions

View File

@@ -1,5 +1,3 @@
from time import monotonic
import httpx
from reflector.processors.base import Processor
from reflector.processors.types import Transcript, TranslationLanguages
@@ -22,22 +20,6 @@ class TranscriptTranslatorProcessor(Processor):
self.timeout = settings.TRANSCRIPT_TIMEOUT
self.headers = {"Authorization": f"Bearer {settings.LLM_MODAL_API_KEY}"}
async def _warmup(self):
try:
async with httpx.AsyncClient() as client:
start = monotonic()
self.logger.debug("Translate modal: warming up...")
response = await client.post(
settings.TRANSCRIPT_URL + "/warmup",
headers=self.headers,
timeout=self.timeout,
)
response.raise_for_status()
duration = monotonic() - start
self.logger.debug(f"Translate modal: warmup took {duration:.2f}s")
except Exception:
self.logger.exception("Translate modal: warmup failed")
async def _push(self, data: Transcript):
self.transcript = data
await self.flush()