mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-29 19:12:30 +08:00
[Feature] Enable prefix caching as default (#3816)
* [Feature] Enable prefix caching as default * [Feature] Enable prefix caching as default * Set prefix caching as default * skip dynamic load * fix kill bug * fix kill bug * fix kill bug * fix ci * fix --------- Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
This commit is contained in:
@@ -181,6 +181,19 @@ def stop_server(signum=None, frame=None):
|
||||
except Exception as e:
|
||||
print(f"Failed to stop server: {e}, {str(traceback.format_exc())}")
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
f"ps -ef -ww | grep {FD_CACHE_QUEUE_PORT} | grep -v grep", shell=True, capture_output=True, text=True
|
||||
)
|
||||
for line in result.stdout.strip().split("\n"):
|
||||
if not line:
|
||||
continue
|
||||
parts = line.split()
|
||||
pid = int(parts[1]) # ps -ef 的第二列是 PID
|
||||
print(f"Killing PID: {pid}")
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
except Exception as e:
|
||||
print(f"Failed to kill cache manager process: {e}, {str(traceback.format_exc())}")
|
||||
for port in [FD_API_PORT, FD_ENGINE_QUEUE_PORT, FD_METRICS_PORT, FD_CACHE_QUEUE_PORT]:
|
||||
try:
|
||||
output = subprocess.check_output(f"lsof -i:{port} -t", shell=True).decode().strip()
|
||||
@@ -285,7 +298,7 @@ def start_service():
|
||||
def switch_service():
|
||||
"""切换模型服务"""
|
||||
# kill掉已有服务
|
||||
stop_server()
|
||||
res, status_code = stop_server()
|
||||
time.sleep(2)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user