MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / wait_server_ready

Function wait_server_ready

python/paddle/hapi/model.py:131–149  ·  view source on GitHub ↗
(endpoints)

Source from the content-addressed store, hash-verified

129
130
131def wait_server_ready(endpoints):
132 assert not isinstance(endpoints, str)
133 while True:
134 all_ok = True
135 not_ready_endpoints = []
136 for ep in endpoints:
137 ip_port = ep.split(":")
138 with contextlib.closing(
139 socket.socket(socket.AF_INET, socket.SOCK_STREAM)
140 ) as sock:
141 sock.settimeout(2)
142 result = sock.connect_ex((ip_port[0], int(ip_port[1])))
143 if result != 0:
144 all_ok = False
145 not_ready_endpoints.append(ep)
146 if not all_ok:
147 time.sleep(3)
148 else:
149 break
150
151
152def init_communicator(

Callers 1

init_communicatorFunction · 0.70

Calls 3

socketMethod · 0.80
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected