This repository has been archived on 2024-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
2023-09-27 21:15:54 -06:00
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
|
|
|
|
from llm_server.routes.cache import redis
|
2023-09-28 03:44:30 -06:00
|
|
|
from llm_server.routes.queue import priority_queue
|
2023-09-27 21:15:54 -06:00
|
|
|
|
2023-09-27 21:28:25 -06:00
|
|
|
logger = logging.getLogger('console_printer')
|
|
|
|
if not logger.handlers:
|
2023-09-27 21:15:54 -06:00
|
|
|
handler = logging.StreamHandler()
|
|
|
|
handler.setLevel(logging.INFO)
|
|
|
|
logger.setLevel(logging.INFO)
|
|
|
|
formatter = logging.Formatter("%(asctime)s: %(levelname)s:%(name)s - %(message)s")
|
|
|
|
handler.setFormatter(formatter)
|
|
|
|
logger.addHandler(handler)
|
|
|
|
|
2023-09-27 21:28:25 -06:00
|
|
|
|
|
|
|
def console_printer():
|
2023-09-27 23:36:44 -06:00
|
|
|
time.sleep(3)
|
2023-09-27 21:28:25 -06:00
|
|
|
while True:
|
2023-09-28 03:44:30 -06:00
|
|
|
processing = redis.hkeys('processing_ips')
|
|
|
|
processing_count = 0
|
|
|
|
for ip in processing:
|
|
|
|
processing_count += int(redis.hget('processing_ips', ip))
|
|
|
|
logger.info(f'REQUEST QUEUE -> Processing: {processing_count} | Queued: {len(priority_queue)}')
|
2023-09-28 03:47:27 -06:00
|
|
|
time.sleep(10)
|