未验证 提交 cc12d27f 编写于 作者: K kuizhiqing 提交者: GitHub

fix tcp LINGER (#45190)

上级 75690584
......@@ -49,6 +49,8 @@ class Node(object):
for _ in range(100):
with closing(socket.socket(socket.AF_INET,
socket.SOCK_STREAM)) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
struct.pack('ii', 1, 0))
s.bind(('', 0))
port = s.getsockname()[1]
if port in self._allocated_ports:
......
......@@ -93,7 +93,7 @@ class CollectiveController(Controller):
self.pod.replicas = self.pod_replicas()
# rank will be reset when restart
self.pod.rank = self.ctx.args.rank
self.pod.rank = int(self.ctx.args.rank)
port = self.ctx.node.get_free_port()
......
......@@ -102,7 +102,7 @@ class HTTPMaster(Master):
print(" ".join(cmd))
print("-" * 80)
if self.ctx.args.rank >= 0:
if int(self.ctx.args.rank) >= 0:
self.ctx.logger.warning(
"--rank set in the command may not compatible in auto mode")
......
......@@ -111,7 +111,7 @@ class PSController(Controller):
def _build_pod_with_master(self):
self.pod.rank = self.ctx.args.rank
self.pod.rank = int(self.ctx.args.rank)
server_num = self.ctx.args.server_num or 1
servers = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册