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.
local-llm-server/test-cluster.py

40 lines
1003 B
Python
Raw Normal View History

try:
import gevent.monkey
gevent.monkey.patch_all()
except ImportError:
pass
import time
from threading import Thread
2023-09-29 00:09:44 -06:00
from llm_server.cluster.redis_cycle import load_backend_cycle
2023-09-29 00:09:44 -06:00
from llm_server.cluster.backend import get_backends, get_a_cluster_backend
from llm_server.cluster.worker import cluster_worker
from llm_server.config.load import parse_backends, load_config
2023-09-29 00:09:44 -06:00
from llm_server.cluster.redis_config_cache import RedisClusterStore
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('config')
args = parser.parse_args()
2023-09-29 00:09:44 -06:00
success, config, msg = load_config(args.config)
cluster_config = RedisClusterStore('cluster_config')
cluster_config.clear()
cluster_config.load(parse_backends(config))
2023-09-29 00:09:44 -06:00
on, off = get_backends()
load_backend_cycle('backend_cycler', on + off)
t = Thread(target=cluster_worker)
t.daemon = True
t.start()
while True:
2023-09-29 00:09:44 -06:00
# online, offline = get_backends()
# print(online, offline)
# print(get_a_cluster_backend())
time.sleep(3)