MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / clean_ports

Function clean_ports

tests/e2e/utils/serving_utils.py:96–113  ·  view source on GitHub ↗

Kill all processes occupying the ports

(ports=None)

Source from the content-addressed store, hash-verified

94
95
96def clean_ports(ports=None):
97 """
98 Kill all processes occupying the ports
99 """
100 if ports is None:
101 ports = PORTS_TO_CLEAN
102
103 print(f"Cleaning ports: {ports}")
104 for port in ports:
105 kill_process_on_port(port)
106
107 # Double check and retry if ports are still in use
108 time.sleep(2)
109 for port in ports:
110 if is_port_open("127.0.0.1", port, timeout=0.1):
111 print(f"Port {port} still in use, retrying cleanup...")
112 kill_process_on_port(port)
113 time.sleep(1)
114
115
116def clean(ports=None):

Callers 15

__init__Method · 0.90
stop_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_w4afp8_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90
setup_and_run_serverFunction · 0.90

Calls 4

printFunction · 0.85
kill_process_on_portFunction · 0.70
is_port_openFunction · 0.70
sleepMethod · 0.45

Tested by 15

__init__Method · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_w4afp8_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72
setup_and_run_serverFunction · 0.72