From 0b19e11313346203414c6a8884834785f8180ee2 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Mon, 24 Jun 2019 10:57:07 +0100 Subject: [PATCH] Updated seldon client --- examples/models/pytorchhub/README.md | 195 +++++++++++++++++- .../pytorch_hub_seldon_deployment.ipynb | 73 +++++-- .../models/pytorchhub/requirements-dev.txt | 1 + 3 files changed, 242 insertions(+), 27 deletions(-) diff --git a/examples/models/pytorchhub/README.md b/examples/models/pytorchhub/README.md index a65c01868e..444b790376 100644 --- a/examples/models/pytorchhub/README.md +++ b/examples/models/pytorchhub/README.md @@ -27,8 +27,6 @@ Make sure you install the following dependencies, as they are critical for this * Helm v2.13.1+ * A Kubernetes cluster running v1.13 or above (minkube / docker-for-windows work well if enough RAM) * kubectl v1.14+ -* ksonnet v0.13.1+ -* kfctl 0.5.1 - Please use this exact version as there are major changes every few months * Python 3.6+ * Python DEV requirements (we'll install them below) @@ -100,7 +98,7 @@ class PyTorchSeldonDeployment: return response_bytes ``` - Writing deployment_image/PyTorchSeldonDeployment.py + Overwriting deployment_image/PyTorchSeldonDeployment.py ### 2.2) Specify the dependencies for your model through a requirements.txt file @@ -113,7 +111,7 @@ torch==1.1.0 image==1.5.27 ``` - Writing deployment_image/requirements.txt + Overwriting deployment_image/requirements.txt ### 2.3) Use source2image to build your container image @@ -205,7 +203,7 @@ spec: ``` - Overwriting pytorch_seldon_template.yaml + Writing pytorch_seldon_template.yaml ### Details: Defining the PyTorch Model through the parameters @@ -242,7 +240,7 @@ In this case we are applying the file with the model `mobilenet_v2` and the depl ```bash %%bash sed 's|MODEL_NAME|mobilenet_v2|g; s|DEPLOYMENT_NAME|mnet|g' pytorch_seldon_template.yaml | \ - kubectl apply -f - + kubectl create -f - ``` seldondeployment.machinelearning.seldon.io/pytorchhub-mnet-deployment created @@ -304,7 +302,7 @@ from seldon_core.seldon_client import SeldonClient sc = SeldonClient( gateway="ambassador", - ambassador_endpoint="localhost:80", + gateway_endpoint="localhost:80", namespace="default", payload_type="bytes", transport="rest") @@ -359,7 +357,188 @@ seldon_message_proto = sc.predict( names=["image_features"]) ``` - + + --------------------------------------------------------------------------- + + ConnectionRefusedError Traceback (most recent call last) + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self) + 158 conn = connection.create_connection( + --> 159 (self._dns_host, self.port), self.timeout, **extra_kw) + 160 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) + 79 if err is not None: + ---> 80 raise err + 81 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) + 69 sock.bind(source_address) + ---> 70 sock.connect(sa) + 71 return sock + + + ConnectionRefusedError: [Errno 111] Connection refused + + + During handling of the above exception, another exception occurred: + + + NewConnectionError Traceback (most recent call last) + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) + 599 body=body, headers=headers, + --> 600 chunked=chunked) + 601 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) + 353 else: + --> 354 conn.request(method, url, **httplib_request_kw) + 355 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked) + 1228 """Send a complete request to the server.""" + -> 1229 self._send_request(method, url, body, headers, encode_chunked) + 1230 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked) + 1274 body = _encode(body, 'body') + -> 1275 self.endheaders(body, encode_chunked=encode_chunked) + 1276 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked) + 1223 raise CannotSendHeader() + -> 1224 self._send_output(message_body, encode_chunked=encode_chunked) + 1225 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked) + 1015 del self._buffer[:] + -> 1016 self.send(msg) + 1017 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py in send(self, data) + 955 if self.auto_open: + --> 956 self.connect() + 957 else: + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py in connect(self) + 180 def connect(self): + --> 181 conn = self._new_conn() + 182 self._prepare_conn(conn) + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py in _new_conn(self) + 167 raise NewConnectionError( + --> 168 self, "Failed to establish a new connection: %s" % e) + 169 + + + NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused + + + During handling of the above exception, another exception occurred: + + + MaxRetryError Traceback (most recent call last) + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) + 448 retries=self.max_retries, + --> 449 timeout=timeout + 450 ) + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) + 637 retries = retries.increment(method, url, error=e, _pool=self, + --> 638 _stacktrace=sys.exc_info()[2]) + 639 retries.sleep() + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) + 398 if new_retry.is_exhausted(): + --> 399 raise MaxRetryError(_pool, url, error or ResponseError(cause)) + 400 + + + MaxRetryError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /seldon/default/pytorchhub-mnet-deployment/api/v0.1/predictions (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) + + + During handling of the above exception, another exception occurred: + + + ConnectionError Traceback (most recent call last) + + in + 5 bin_data=pickle.dumps(input_batch), + 6 deployment_name="pytorchhub-mnet-deployment", + ----> 7 names=["image_features"]) + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/seldon_core/seldon_client.py in predict(self, gateway, transport, deployment_name, payload_type, oauth_key, oauth_secret, seldon_rest_endpoint, seldon_grpc_endpoint, gateway_endpoint, microservice_endpoint, method, shape, namespace, data, bin_data, str_data, names, gateway_prefix, headers) + 229 if k["gateway"] == "ambassador" or k["gateway"] == "istio": + 230 if k["transport"] == "rest": + --> 231 return rest_predict_gateway(**k) + 232 elif k["transport"] == "grpc": + 233 return grpc_predict_gateway(**k) + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/seldon_core/seldon_client.py in rest_predict_gateway(deployment_name, namespace, gateway_endpoint, shape, data, headers, gateway_prefix, payload_type, bin_data, str_data, names, **kwargs) + 1058 "http://" + gateway_endpoint + "/seldon/" + namespace + "/" + deployment_name + "/api/v0.1/predictions", + 1059 json=payload, + -> 1060 headers=headers) + 1061 else: + 1062 response_raw = requests.post( + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/api.py in post(url, data, json, **kwargs) + 114 """ + 115 + --> 116 return request('post', url, data=data, json=json, **kwargs) + 117 + 118 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/api.py in request(method, url, **kwargs) + 58 # cases, and look like a memory leak in others. + 59 with sessions.Session() as session: + ---> 60 return session.request(method=method, url=url, **kwargs) + 61 + 62 + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) + 531 } + 532 send_kwargs.update(settings) + --> 533 resp = self.send(prep, **send_kwargs) + 534 + 535 return resp + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/sessions.py in send(self, request, **kwargs) + 644 + 645 # Send the request + --> 646 r = adapter.send(request, **kwargs) + 647 + 648 # Total elapsed time of the request (approximately) + + + ~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) + 514 raise SSLError(e, request=request) + 515 + --> 516 raise ConnectionError(e, request=request) + 517 + 518 except ClosedPoolError as e: + + + ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /seldon/default/pytorchhub-mnet-deployment/api/v0.1/predictions (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) diff --git a/examples/models/pytorchhub/pytorch_hub_seldon_deployment.ipynb b/examples/models/pytorchhub/pytorch_hub_seldon_deployment.ipynb index 7d5f196407..b9014354e1 100644 --- a/examples/models/pytorchhub/pytorch_hub_seldon_deployment.ipynb +++ b/examples/models/pytorchhub/pytorch_hub_seldon_deployment.ipynb @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 167, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -99,14 +99,14 @@ }, { "cell_type": "code", - "execution_count": 168, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing deployment_image/PyTorchSeldonDeployment.py\n" + "Overwriting deployment_image/PyTorchSeldonDeployment.py\n" ] } ], @@ -148,14 +148,14 @@ }, { "cell_type": "code", - "execution_count": 169, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Writing deployment_image/requirements.txt\n" + "Overwriting deployment_image/requirements.txt\n" ] } ], @@ -250,14 +250,14 @@ }, { "cell_type": "code", - "execution_count": 172, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Overwriting pytorch_seldon_template.yaml\n" + "Writing pytorch_seldon_template.yaml\n" ] } ], @@ -340,7 +340,7 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -354,7 +354,7 @@ "source": [ "%%bash \n", "sed 's|MODEL_NAME|mobilenet_v2|g; s|DEPLOYMENT_NAME|mnet|g' pytorch_seldon_template.yaml | \\\n", - " kubectl apply -f -" + " kubectl create -f -" ] }, { @@ -2190,7 +2190,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -2198,7 +2198,7 @@ "\n", "sc = SeldonClient(\n", " gateway=\"ambassador\", \n", - " ambassador_endpoint=\"localhost:80\",\n", + " gateway_endpoint=\"localhost:80\",\n", " namespace=\"default\",\n", " payload_type=\"bytes\",\n", " transport=\"rest\")" @@ -2213,7 +2213,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -2240,7 +2240,7 @@ }, { "cell_type": "code", - "execution_count": 134, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -2249,7 +2249,7 @@ "torch.Size([1, 3, 224, 224])" ] }, - "execution_count": 134, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -2271,14 +2271,49 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 5, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" + "ename": "ConnectionError", + "evalue": "HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /seldon/default/pytorchhub-mnet-deployment/api/v0.1/predictions (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mConnectionRefusedError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py\u001b[0m in \u001b[0;36m_new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 158\u001b[0m conn = connection.create_connection(\n\u001b[0;32m--> 159\u001b[0;31m (self._dns_host, self.port), self.timeout, **extra_kw)\n\u001b[0m\u001b[1;32m 160\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/connection.py\u001b[0m in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 79\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0merr\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 80\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 81\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/connection.py\u001b[0m in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[0msock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbind\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msource_address\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 70\u001b[0;31m \u001b[0msock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msa\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 71\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0msock\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mConnectionRefusedError\u001b[0m: [Errno 111] Connection refused", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mNewConnectionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 599\u001b[0m \u001b[0mbody\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mheaders\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 600\u001b[0;31m chunked=chunked)\n\u001b[0m\u001b[1;32m 601\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 353\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 354\u001b[0;31m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mhttplib_request_kw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 355\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1228\u001b[0m \u001b[0;34m\"\"\"Send a complete request to the server.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1229\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_send_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mheaders\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1230\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py\u001b[0m in \u001b[0;36m_send_request\u001b[0;34m(self, method, url, body, headers, encode_chunked)\u001b[0m\n\u001b[1;32m 1274\u001b[0m \u001b[0mbody\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_encode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'body'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1275\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mendheaders\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1276\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py\u001b[0m in \u001b[0;36mendheaders\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m 1223\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mCannotSendHeader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1224\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_send_output\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage_body\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mencode_chunked\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mencode_chunked\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1225\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py\u001b[0m in \u001b[0;36m_send_output\u001b[0;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[1;32m 1015\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_buffer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1016\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1017\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/http/client.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, data)\u001b[0m\n\u001b[1;32m 955\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mauto_open\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 956\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 957\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py\u001b[0m in \u001b[0;36mconnect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 181\u001b[0;31m \u001b[0mconn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_new_conn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 182\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_prepare_conn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connection.py\u001b[0m in \u001b[0;36m_new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 167\u001b[0m raise NewConnectionError(\n\u001b[0;32m--> 168\u001b[0;31m self, \"Failed to establish a new connection: %s\" % e)\n\u001b[0m\u001b[1;32m 169\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNewConnectionError\u001b[0m: : Failed to establish a new connection: [Errno 111] Connection refused", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mMaxRetryError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/adapters.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 448\u001b[0m \u001b[0mretries\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmax_retries\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 449\u001b[0;31m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 450\u001b[0m )\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 637\u001b[0m retries = retries.increment(method, url, error=e, _pool=self,\n\u001b[0;32m--> 638\u001b[0;31m _stacktrace=sys.exc_info()[2])\n\u001b[0m\u001b[1;32m 639\u001b[0m \u001b[0mretries\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/urllib3/util/retry.py\u001b[0m in \u001b[0;36mincrement\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 398\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mnew_retry\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_exhausted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 399\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mMaxRetryError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pool\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merror\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mResponseError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcause\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 400\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mMaxRetryError\u001b[0m: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /seldon/default/pytorchhub-mnet-deployment/api/v0.1/predictions (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mbin_data\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpickle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdumps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_batch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mdeployment_name\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"pytorchhub-mnet-deployment\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m names=[\"image_features\"])\n\u001b[0m", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/seldon_core/seldon_client.py\u001b[0m in \u001b[0;36mpredict\u001b[0;34m(self, gateway, transport, deployment_name, payload_type, oauth_key, oauth_secret, seldon_rest_endpoint, seldon_grpc_endpoint, gateway_endpoint, microservice_endpoint, method, shape, namespace, data, bin_data, str_data, names, gateway_prefix, headers)\u001b[0m\n\u001b[1;32m 229\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"gateway\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"ambassador\"\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"gateway\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"istio\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"transport\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"rest\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 231\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mrest_predict_gateway\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 232\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"transport\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"grpc\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 233\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mgrpc_predict_gateway\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/seldon_core/seldon_client.py\u001b[0m in \u001b[0;36mrest_predict_gateway\u001b[0;34m(deployment_name, namespace, gateway_endpoint, shape, data, headers, gateway_prefix, payload_type, bin_data, str_data, names, **kwargs)\u001b[0m\n\u001b[1;32m 1058\u001b[0m \u001b[0;34m\"http://\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mgateway_endpoint\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m\"/seldon/\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mnamespace\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m\"/\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mdeployment_name\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m\"/api/v0.1/predictions\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1059\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpayload\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1060\u001b[0;31m headers=headers)\n\u001b[0m\u001b[1;32m 1061\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1062\u001b[0m response_raw = requests.post(\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/api.py\u001b[0m in \u001b[0;36mpost\u001b[0;34m(url, data, json, **kwargs)\u001b[0m\n\u001b[1;32m 114\u001b[0m \"\"\"\n\u001b[1;32m 115\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 116\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'post'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mjson\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 117\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 118\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/api.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(method, url, **kwargs)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0;31m# cases, and look like a memory leak in others.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0msessions\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSession\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 60\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 531\u001b[0m }\n\u001b[1;32m 532\u001b[0m \u001b[0msend_kwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msettings\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m \u001b[0mresp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprep\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0msend_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 644\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 645\u001b[0m \u001b[0;31m# Send the request\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 646\u001b[0;31m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0madapter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 647\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 648\u001b[0m \u001b[0;31m# Total elapsed time of the request (approximately)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/miniconda3/envs/reddit-classification/lib/python3.7/site-packages/requests/adapters.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 514\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mSSLError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 515\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 516\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mConnectionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 517\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 518\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mClosedPoolError\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mConnectionError\u001b[0m: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /seldon/default/pytorchhub-mnet-deployment/api/v0.1/predictions (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))" ] } ], diff --git a/examples/models/pytorchhub/requirements-dev.txt b/examples/models/pytorchhub/requirements-dev.txt index 1302b2ea50..ae9b63e6dd 100644 --- a/examples/models/pytorchhub/requirements-dev.txt +++ b/examples/models/pytorchhub/requirements-dev.txt @@ -1,3 +1,4 @@ numpy==1.15.4 torch==1.1.0 image==1.5.27 +seldon-core==0.3.0