From 8f30dfae7122839f8a1e1585bb3f100c4873ffbf Mon Sep 17 00:00:00 2001 From: Clive Cox Date: Wed, 12 Dec 2018 10:05:23 +0000 Subject: [PATCH] update timoeuts demo notebook --- notebooks/resources/model_short_timeouts.json | 2 +- notebooks/timeouts.ipynb | 249 ++++++++++++------ 2 files changed, 174 insertions(+), 77 deletions(-) diff --git a/notebooks/resources/model_short_timeouts.json b/notebooks/resources/model_short_timeouts.json index 7c0f81743d..3d54c52e3b 100644 --- a/notebooks/resources/model_short_timeouts.json +++ b/notebooks/resources/model_short_timeouts.json @@ -22,7 +22,7 @@ "spec": { "containers": [ { - "image": "seldonio/mock_classifier_rest:1.0", + "image": "seldonio/mock_classifier:1.0", "imagePullPolicy": "IfNotPresent", "name": "classifier", "resources": { diff --git a/notebooks/timeouts.ipynb b/notebooks/timeouts.ipynb index 3d2a9018d7..0a5c72be18 100644 --- a/notebooks/timeouts.ipynb +++ b/notebooks/timeouts.ipynb @@ -49,7 +49,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "namespace \"seldon\" created\r\n" + "namespace/seldon created\r\n" ] } ], @@ -57,6 +57,23 @@ "!kubectl create namespace seldon" ] }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Context \"minikube\" modified.\r\n" + ] + } + ], + "source": [ + "!kubectl config set-context $(kubectl config current-context) --namespace=seldon" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -66,7 +83,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "clusterrolebinding \"kube-system-cluster-admin\" created\r\n" + "clusterrolebinding.rbac.authorization.k8s.io/kube-system-cluster-admin created\r\n" ] } ], @@ -90,8 +107,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "serviceaccount \"tiller\" created\n", - "clusterrolebinding \"tiller\" created\n", + "serviceaccount/tiller created\n", + "clusterrolebinding.rbac.authorization.k8s.io/tiller created\n", "$HELM_HOME has been configured at /home/clive/.helm.\n", "\n", "Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n", @@ -109,6 +126,23 @@ "!helm init --service-account tiller" ] }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "deployment \"tiller-deploy\" successfully rolled out\r\n" + ] + } + ], + "source": [ + "!kubectl rollout status deploy/tiller-deploy -n kube-system" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -125,7 +159,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -133,11 +167,15 @@ "output_type": "stream", "text": [ "NAME: seldon-core-crd\n", - "LAST DEPLOYED: Thu Aug 30 09:59:45 2018\n", + "LAST DEPLOYED: Wed Dec 12 09:50:51 2018\n", "NAMESPACE: default\n", "STATUS: DEPLOYED\n", "\n", "RESOURCES:\n", + "==> v1beta1/CustomResourceDefinition\n", + "NAME AGE\n", + "seldondeployments.machinelearning.seldon.io 0s\n", + "\n", "==> v1beta1/Deployment\n", "NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE\n", "seldon-spartakus-volunteer 1 0 0 0 0s\n", @@ -156,11 +194,7 @@ "\n", "==> v1/ConfigMap\n", "NAME DATA AGE\n", - "seldon-spartakus-config 3 1s\n", - "\n", - "==> v1beta1/CustomResourceDefinition\n", - "NAME AGE\n", - "seldondeployments.machinelearning.seldon.io 0s\n", + "seldon-spartakus-config 3 0s\n", "\n", "\n", "NOTES:\n", @@ -176,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -184,49 +218,21 @@ "output_type": "stream", "text": [ "NAME: seldon-core\n", - "LAST DEPLOYED: Thu Aug 30 09:59:52 2018\n", + "LAST DEPLOYED: Wed Dec 12 09:50:55 2018\n", "NAMESPACE: seldon\n", "STATUS: DEPLOYED\n", "\n", "RESOURCES:\n", - "==> v1/ServiceAccount\n", - "NAME SECRETS AGE\n", - "seldon 1 0s\n", - "\n", - "==> v1beta1/Role\n", - "NAME AGE\n", - "ambassador 0s\n", - "seldon-local 0s\n", - "\n", - "==> v1/RoleBinding\n", - "NAME AGE\n", - "seldon 0s\n", - "\n", - "==> v1/Pod(related)\n", - "NAME READY STATUS RESTARTS AGE\n", - "seldon-core-ambassador-7fb4575f6b-js5lm 0/2 ContainerCreating 0 0s\n", - "seldon-core-seldon-apiserver-68f5984b49-svn5r 0/1 ContainerCreating 0 0s\n", - "seldon-core-seldon-cluster-manager-9fdd5d6df-jj58f 0/1 ContainerCreating 0 0s\n", - "seldon-core-redis-575979b79b-5swz9 0/1 ContainerCreating 0 0s\n", - "\n", - "==> v1beta1/ClusterRole\n", - "NAME AGE\n", - "seldon-crd 0s\n", - "\n", - "==> v1/ClusterRoleBinding\n", - "NAME AGE\n", - "seldon 0s\n", - "\n", "==> v1beta1/RoleBinding\n", "NAME AGE\n", "ambassador 0s\n", "\n", "==> v1/Service\n", "NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\n", - "seldon-core-ambassador-admin NodePort 10.99.43.159 8877:32301/TCP 0s\n", - "seldon-core-ambassador NodePort 10.103.77.131 8080:31756/TCP 0s\n", - "seldon-core-seldon-apiserver NodePort 10.111.157.153 8080:31229/TCP,5000:31036/TCP 0s\n", - "seldon-core-redis ClusterIP 10.106.34.84 6379/TCP 0s\n", + "seldon-core-ambassador NodePort 10.106.122.3 80:30082/TCP,443:30194/TCP 0s\n", + "seldon-core-ambassador-admin NodePort 10.103.200.155 8877:31478/TCP 0s\n", + "seldon-core-seldon-apiserver NodePort 10.109.138.92 8080:31585/TCP,5000:30119/TCP 0s\n", + "seldon-core-redis ClusterIP 10.100.249.124 6379/TCP 0s\n", "\n", "==> v1beta1/Deployment\n", "NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE\n", @@ -235,6 +241,26 @@ "seldon-core-seldon-cluster-manager 1 1 1 0 0s\n", "seldon-core-redis 1 1 1 0 0s\n", "\n", + "==> v1/Pod(related)\n", + "NAME READY STATUS RESTARTS AGE\n", + "seldon-core-ambassador-56cb8fc595-ktkkb 0/1 ContainerCreating 0 0s\n", + "seldon-core-seldon-apiserver-9cc778f6f-4jwdl 0/1 ContainerCreating 0 0s\n", + "seldon-core-seldon-cluster-manager-67467f6d5d-v68pn 0/1 ContainerCreating 0 0s\n", + "seldon-core-redis-78bb97f8c4-krcgv 0/1 ContainerCreating 0 0s\n", + "\n", + "==> v1/ServiceAccount\n", + "NAME SECRETS AGE\n", + "seldon 1 0s\n", + "\n", + "==> v1beta1/Role\n", + "NAME AGE\n", + "ambassador 0s\n", + "seldon-local 0s\n", + "\n", + "==> v1/RoleBinding\n", + "NAME AGE\n", + "seldon 0s\n", + "\n", "\n", "NOTES:\n", "Thank you for installing Seldon Core.\n", @@ -261,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -270,7 +296,7 @@ "text": [ "deployment \"seldon-core-seldon-cluster-manager\" successfully rolled out\n", "deployment \"seldon-core-seldon-apiserver\" successfully rolled out\n", - "Waiting for rollout to finish: 0 of 1 updated replicas are available...\n", + "Waiting for deployment \"seldon-core-ambassador\" rollout to finish: 0 of 1 updated replicas are available...\n", "deployment \"seldon-core-ambassador\" successfully rolled out\n" ] } @@ -317,7 +343,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -348,7 +374,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -423,7 +449,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -454,7 +480,7 @@ " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", " \u001b[34;01m\"containers\"\u001b[39;49;00m: [\r\n", " {\r\n", - " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mock_classifier_grpc:1.0\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mock_classifier_rest:1.0\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"imagePullPolicy\"\u001b[39;49;00m: \u001b[33m\"IfNotPresent\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"classifier\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"resources\"\u001b[39;49;00m: {\r\n", @@ -471,7 +497,7 @@ " \u001b[34;01m\"children\"\u001b[39;49;00m: [],\r\n", " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"classifier\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"endpoint\"\u001b[39;49;00m: {\r\n", - "\t\t\t\u001b[34;01m\"type\"\u001b[39;49;00m : \u001b[33m\"GRPC\"\u001b[39;49;00m\r\n", + "\t\t\t\u001b[34;01m\"type\"\u001b[39;49;00m : \u001b[33m\"REST\"\u001b[39;49;00m\r\n", "\t\t },\r\n", " \u001b[34;01m\"type\"\u001b[39;49;00m: \u001b[33m\"MODEL\"\u001b[39;49;00m\r\n", " },\r\n", @@ -507,14 +533,14 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "seldondeployment \"seldon-deployment-example\" created\r\n" + "seldondeployment.machinelearning.seldon.io/seldon-deployment-example created\r\n" ] } ], @@ -524,18 +550,83 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NAME CREATED AT\r\n", + "seldon-deployment-example 1m\r\n" + ] + } + ], "source": [ "!kubectl get seldondeployments -n seldon" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Name: seldon-deployment-example\r\n", + "Namespace: seldon\r\n", + "Labels: app=seldon\r\n", + "Annotations: kubectl.kubernetes.io/last-applied-configuration:\r\n", + " {\"apiVersion\":\"machinelearning.seldon.io/v1alpha2\",\"kind\":\"SeldonDeployment\",\"metadata\":{\"name\":\"seldon-deployment-example\",\"namespace\":\"s...\r\n", + "API Version: machinelearning.seldon.io/v1alpha2\r\n", + "Kind: SeldonDeployment\r\n", + "Metadata:\r\n", + " Cluster Name: \r\n", + " Creation Timestamp: 2018-12-12T10:01:24Z\r\n", + " Generation: 1\r\n", + " Resource Version: 3077\r\n", + " Self Link: /apis/machinelearning.seldon.io/v1alpha2/namespaces/seldon/seldondeployments/seldon-deployment-example\r\n", + " UID: e2505c16-fdf4-11e8-841b-e4d4f6ca9562\r\n", + "Spec:\r\n", + " Annotations:\r\n", + " Deployment Version: v1\r\n", + " Project Name: FX Market Prediction\r\n", + " Seldon . Io / Rest - Read - Timeout: 1\r\n", + " Name: test-deployment\r\n", + " Oauth Key: oauth-key\r\n", + " Oauth Secret: oauth-secret\r\n", + " Predictors:\r\n", + " Annotations:\r\n", + " Predictor Version: v1\r\n", + " Component Specs:\r\n", + " Spec:\r\n", + " Containers:\r\n", + " Image: seldonio/mock_classifier:1.0\r\n", + " Image Pull Policy: IfNotPresent\r\n", + " Name: classifier\r\n", + " Resources:\r\n", + " Requests:\r\n", + " Memory: 1Mi\r\n", + " Termination Grace Period Seconds: 20\r\n", + " Graph:\r\n", + " Endpoint:\r\n", + " Type: REST\r\n", + " Name: classifier\r\n", + " Type: MODEL\r\n", + " Name: fx-market-predictor\r\n", + " Replicas: 1\r\n", + "Status:\r\n", + " Predictor Status:\r\n", + " Name: test-deployment-fx-market-predictor-7cd068f\r\n", + " Replicas: 1\r\n", + " Replicas Available: 1\r\n", + " State: Available\r\n", + "Events: \r\n" + ] + } + ], "source": [ "!kubectl describe seldondeployments seldon-deployment-example -n seldon" ] @@ -556,7 +647,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "map[predictorStatus:[map[replicasAvailable:1 name:test-deployment-fx-market-predictor-svc-orch replicas:1] map[name:test-deployment-fx-market-predictor-classifier-0 replicas:1 replicasAvailable:1]]]" + "map[predictorStatus:[map[replicas:1 replicasAvailable:1 name:test-deployment-fx-market-predictor-7cd068f]] state:Available]" ] } ], @@ -580,14 +671,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{\"access_token\":\"02843613-4954-4c75-8dd2-ab9d61fbfe16\",\"token_type\":\"bearer\",\"expires_in\":43151,\"scope\":\"read write\"}\n", + "{\"access_token\":\"9d9ed9cf-b065-406b-98c9-0ce0fa92f495\",\"token_type\":\"bearer\",\"expires_in\":43199,\"scope\":\"read write\"}\n", "{\n", " \"code\": 103,\n", " \"info\": \"Status code: 500 Reason: \",\n", @@ -605,19 +696,19 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Send a large request which will be above the default gRPC message size and will fail." + "Delete this graph and recreate one with a longer timeout" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "seldondeployment \"seldon-deployment-example\" deleted\r\n" + "seldondeployment.machinelearning.seldon.io \"seldon-deployment-example\" deleted\r\n" ] } ], @@ -627,7 +718,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -647,7 +738,9 @@ " \u001b[34;01m\"annotations\"\u001b[39;49;00m: {\r\n", " \u001b[34;01m\"project_name\"\u001b[39;49;00m: \u001b[33m\"FX Market Prediction\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"deployment_version\"\u001b[39;49;00m: \u001b[33m\"v1\"\u001b[39;49;00m,\r\n", - "\t \u001b[34;01m\"seldon.io/rest-read-timeout\"\u001b[39;49;00m:\u001b[33m\"10000\"\u001b[39;49;00m\r\n", + "\t \u001b[34;01m\"seldon.io/rest-read-timeout\"\u001b[39;49;00m:\u001b[33m\"10000\"\u001b[39;49;00m,\r\n", + "\t \u001b[34;01m\"seldon.io/rest-connection-timeout\"\u001b[39;49;00m:\u001b[33m\"10000\"\u001b[39;49;00m,\t \r\n", + "\t \u001b[34;01m\"seldon.io/grpc-read-timeout\"\u001b[39;49;00m:\u001b[33m\"10000\"\u001b[39;49;00m\r\n", " },\r\n", " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"test-deployment\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"oauth_key\"\u001b[39;49;00m: \u001b[33m\"oauth-key\"\u001b[39;49;00m,\r\n", @@ -658,7 +751,7 @@ " \u001b[34;01m\"spec\"\u001b[39;49;00m: {\r\n", " \u001b[34;01m\"containers\"\u001b[39;49;00m: [\r\n", " {\r\n", - " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mock_classifier_rest:1.0\"\u001b[39;49;00m,\r\n", + " \u001b[34;01m\"image\"\u001b[39;49;00m: \u001b[33m\"seldonio/mock_classifier:1.0\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"imagePullPolicy\"\u001b[39;49;00m: \u001b[33m\"IfNotPresent\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"name\"\u001b[39;49;00m: \u001b[33m\"classifier\"\u001b[39;49;00m,\r\n", " \u001b[34;01m\"resources\"\u001b[39;49;00m: {\r\n", @@ -697,14 +790,14 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "seldondeployment \"seldon-deployment-example\" created\r\n" + "seldondeployment.machinelearning.seldon.io/seldon-deployment-example created\r\n" ] } ], @@ -714,14 +807,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 28, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "map[predictorStatus:[map[replicas:1 replicasAvailable:1 name:test-deployment-fx-market-predictor-svc-orch] map[replicasAvailable:1 name:test-deployment-fx-market-predictor-classifier-0 replicas:1]]]" + "map[state:Available predictorStatus:[map[name:test-deployment-fx-market-predictor-7cd068f replicas:1 replicasAvailable:1]]]" ] } ], @@ -733,26 +826,30 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This nrxt request should work as the timeout is much longer" + "This next request should work as the timeout is much longer" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 29, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{\"access_token\":\"02843613-4954-4c75-8dd2-ab9d61fbfe16\",\"token_type\":\"bearer\",\"expires_in\":42938,\"scope\":\"read write\"}\n", + "{\"access_token\":\"9d9ed9cf-b065-406b-98c9-0ce0fa92f495\",\"token_type\":\"bearer\",\"expires_in\":43085,\"scope\":\"read write\"}\n", "{\n", " \"meta\": {\n", - " \"puid\": \"g7u0qmuvc8tmlu9aslbgtghh4p\",\n", + " \"puid\": \"31rs5r6vu57i86vb1650gfpsbi\",\n", " \"tags\": {\n", " },\n", " \"routing\": {\n", - " }\n", + " },\n", + " \"requestPath\": {\n", + " \"classifier\": \"seldonio/mock_classifier:1.0\"\n", + " },\n", + " \"metrics\": []\n", " },\n", " \"data\": {\n", " \"names\": [\"proba\"],\n",