File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1313import yaml
1414from flask import Flask , Response , jsonify , request
1515
16+ current_dir = os .path .dirname (os .path .abspath (__file__ ))
17+ tests_dir = os .path .abspath (os .path .join (current_dir , ".." , ".." ))
18+
19+ sys .path .insert (0 , tests_dir )
20+
21+ from e2e .utils .serving_utils import (
22+ FD_API_PORT ,
23+ FD_CACHE_QUEUE_PORT ,
24+ FD_ENGINE_QUEUE_PORT ,
25+ FD_METRICS_PORT ,
26+ clean_ports ,
27+ )
28+
1629app = Flask (__name__ )
1730
1831
@@ -56,10 +69,6 @@ def get_available_port(env_key: str, default_start: int):
5669LOG_FILE = "server.log"
5770base_port = get_base_port ()
5871FLASK_PORT = get_available_port ("FLASK_PORT" , base_port + 1 )
59- FD_API_PORT = get_available_port ("FD_API_PORT" , FLASK_PORT + 1 )
60- FD_ENGINE_QUEUE_PORT = get_available_port ("FD_ENGINE_QUEUE_PORT" , FD_API_PORT + 1 )
61- FD_METRICS_PORT = get_available_port ("FD_METRICS_PORT" , FD_ENGINE_QUEUE_PORT + 1 )
62- FD_CACHE_QUEUE_PORT = get_available_port ("FD_CACHE_QUEUE_PORT" , FD_METRICS_PORT + 1 )
6372DEFAULT_PARAMS = {
6473 "--port" : FD_API_PORT ,
6574 "--engine-worker-queue-port" : FD_ENGINE_QUEUE_PORT ,
@@ -176,6 +185,7 @@ def stop_server(signum=None, frame=None):
176185 os .remove ("gemm_profiles.json" )
177186
178187 try :
188+ clean_ports ()
179189 # 终止进程组(包括所有子进程)
180190 os .killpg (os .getpgid (pid_port ["PID" ]), signal .SIGTERM )
181191 except Exception as e :
You can’t perform that action at this time.
0 commit comments