22 lines
619 B
Python
22 lines
619 B
Python
import sys
|
|
|
|
from redis import Redis
|
|
|
|
from llm_server.custom_redis import redis
|
|
from llm_server.routes.v1.generate_stats import generate_stats
|
|
|
|
|
|
def server_startup(s):
|
|
if not redis.get('daemon_started', dtype=bool):
|
|
print('Could not find the key daemon_started in Redis. Did you forget to start the daemon process?')
|
|
sys.exit(1)
|
|
|
|
# Flush the RedisPriorityQueue database.
|
|
queue_redis = Redis(host='localhost', port=6379, db=15)
|
|
for key in queue_redis.scan_iter('*'):
|
|
queue_redis.delete(key)
|
|
|
|
# Cache the initial stats
|
|
print('Loading backend stats...')
|
|
generate_stats()
|