From ff900dde24d0aacbba142096042109ecc9625a27 Mon Sep 17 00:00:00 2001 From: cliveseldon Date: Thu, 7 Apr 2022 11:12:55 +0100 Subject: [PATCH] Dataflow updates (#140) * fix dataflow bugs * lint * small updates for docker compose tests * update install doc at top of notebook * Typo fix Co-authored-by: Andrei Paleyes --- Makefile | 8 ++++ samples/local-examples.ipynb | 70 +++++++++++++++++++++++++++++---- samples/pipeline-examples.ipynb | 16 ++++---- scheduler/config/agent.yaml | 3 +- 4 files changed, 80 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index b5f5da7a38..d584906271 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,14 @@ deploy-local: undeploy-local: make -C scheduler stop-all +.PHONY: deploy-local-triton +deploy-local-triton: + make -C scheduler start-all-triton + +.PHONY: undeploy-local-triton +undeploy-local-triton: + make -C scheduler stop-all-triton + .PHONY: deploy-k8s deploy-k8s: kubectl create -f k8s/seldon-v2-crds.yaml diff --git a/samples/local-examples.ipynb b/samples/local-examples.ipynb index 68b642e2cb..575a52ff16 100644 --- a/samples/local-examples.ipynb +++ b/samples/local-examples.ipynb @@ -14,10 +14,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "modular-digest", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "/home/clive/work/scv2/seldon-core-v2/operator/bin/seldon\r\n" + ] + } + ], "source": [ "!which seldon" ] @@ -32,20 +40,58 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "8b4be911", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "apiVersion: mlops.seldon.io/v1alpha1\r\n", + "kind: Model\r\n", + "metadata:\r\n", + " name: iris\r\n", + " namespace: seldon-mesh\r\n", + "spec:\r\n", + " storageUri: \"gs://seldon-models/mlserver/iris\"\r\n", + " requirements:\r\n", + " - sklearn\r\n" + ] + } + ], "source": [ "!cat ./models/sklearn-iris-gs.yaml" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "checked-cream", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error: rpc error: code = FailedPrecondition desc = failed to schedule model iris\r\n", + "Usage:\r\n", + " app model load [flags]\r\n", + "\r\n", + "Flags:\r\n", + " -f, --file-path string model file to load\r\n", + " -h, --help help for load\r\n", + " --scheduler-host string seldon scheduler host (default \"0.0.0.0\")\r\n", + " --scheduler-port int seldon scheduler port (default 9004)\r\n", + "\r\n", + "Global Flags:\r\n", + " -r, --show-request show request\r\n", + " -s, --show-response show response (default true)\r\n", + "\r\n", + "rpc error: code = FailedPrecondition desc = failed to schedule model iris\r\n" + ] + } + ], "source": [ "!seldon model load -f ./models/sklearn-iris-gs.yaml" ] @@ -84,10 +130,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "ceramic-illness", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\r\n" + ] + } + ], "source": [ "!seldon model unload --model-name iris" ] diff --git a/samples/pipeline-examples.ipynb b/samples/pipeline-examples.ipynb index d3504c18cd..9f09eb2d95 100644 --- a/samples/pipeline-examples.ipynb +++ b/samples/pipeline-examples.ipynb @@ -9,8 +9,8 @@ "\n", "\n", " * Build if needed and place `seldon` binary in your path\n", - " * Install seldon locally \n", - " * Start triton" + " * run `make build-seldon` from operator folder and add bin folder to PATH\n", + " * Run Seldon V2 `make deploy-local-triton` from top level folder" ] }, { @@ -108,12 +108,12 @@ { "cell_type": "code", "execution_count": null, - "id": "1f5fb4bd", + "id": "5c33133e", "metadata": {}, "outputs": [], "source": [ - "!seldon pipeline infer -p tfsimples \\\n", - " '{\"inputs\":[{\"name\":\"INPUT0\",\"data\": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"data\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],\"datatype\":\"INT32\",\"shape\":[1,16]}]}' " + "!seldon pipeline infer -p tfsimples --inference-mode grpc \\\n", + " '{\"model_name\":\"simple\",\"inputs\":[{\"name\":\"INPUT0\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]}]}' | jq ." ] }, { @@ -214,12 +214,12 @@ { "cell_type": "code", "execution_count": null, - "id": "a5b541d5", + "id": "2151ee4c", "metadata": {}, "outputs": [], "source": [ - "!seldon pipeline infer -p join \\\n", - " '{\"inputs\":[{\"name\":\"INPUT0\",\"data\": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"data\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],\"datatype\":\"INT32\",\"shape\":[1,16]}]}' " + "!seldon pipeline infer -p join --inference-mode grpc \\\n", + " '{\"model_name\":\"simple\",\"inputs\":[{\"name\":\"INPUT0\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]}]}' | jq ." ] }, { diff --git a/scheduler/config/agent.yaml b/scheduler/config/agent.yaml index be0db6a2cd..f0a3e9848c 100644 --- a/scheduler/config/agent.yaml +++ b/scheduler/config/agent.yaml @@ -3,4 +3,5 @@ rclone: - '{"type":"google cloud storage","name":"gs","parameters":{"anonymous":true}}' kafka: active: true - broker: "0.0.0.0:9092" + broker: "kafka:29092" + #broker: "0.0.0.0:9092"