提交 66cc9050 编写于 作者: B barrierye

fix: could not access services in the container

上级 67b5dbca
......@@ -256,7 +256,7 @@ class Server(object):
def port_is_available(self, port):
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(2)
result = sock.connect_ex(('127.0.0.1', port))
result = sock.connect_ex(('0.0.0.0', port))
if result != 0:
return True
else:
......
......@@ -54,7 +54,7 @@ class WebService(object):
client_service = Client()
client_service.load_client_config(
"{}/serving_server_conf.prototxt".format(self.model_config))
client_service.connect(["127.0.0.1:{}".format(self.port + 1)])
client_service.connect(["0.0.0.0:{}".format(self.port + 1)])
service_name = "/" + self.name + "/prediction"
@app_instance.route(service_name, methods=['POST'])
......
......@@ -266,7 +266,7 @@ class Server(object):
def port_is_available(self, port):
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(2)
result = sock.connect_ex(('127.0.0.1', port))
result = sock.connect_ex(('0.0.0.0', port))
if result != 0:
return True
else:
......
......@@ -95,7 +95,7 @@ class WebService(object):
client_service = Client()
client_service.load_client_config(
"{}/serving_server_conf.prototxt".format(self.model_config))
client_service.connect(["127.0.0.1:{}".format(self.port + i + 1)])
client_service.connect(["0.0.0.0:{}".format(self.port + i + 1)])
client_list.append(client_service)
time.sleep(1)
service_name = "/" + self.name + "/prediction"
......
......@@ -80,7 +80,7 @@ class BertServer():
def build_server(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', self.port))
sock.bind(('0.0.0.0', self.port))
sock.listen(5)
print('Main server serving on {} port.'.format(self.port))
while True:
......@@ -122,7 +122,7 @@ class BertServer():
with closing(socket.socket(socket.AF_INET,
socket.SOCK_STREAM)) as sock:
sock.settimeout(2)
result = sock.connect_ex(('127.0.0.1', port))
result = sock.connect_ex(('0.0.0.0', port))
if result != 0:
return port
return -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册