Wallaroo Edge Arbitrary Python Deployment Demonstration
This tutorial can be downloaded as part of the Wallaroo Tutorials repository.
Arbitrary Python Edge Deploy
This tutorial demonstrates how to use arbitrary python as a ML Model in Wallaroo and deploy the pipeline, then deploy that same pipeline to edge devices through an Open Container Initiative Registry, registered in the Wallaroo instance as the Edge Deployment Registry.
Tutorial Goals
- In Wallaroo Ops:
- Arbitrary Python Tutorial Deploy Model in Wallaroo Upload and Deploy: Deploys the
KMeans
model in an arbitrary Python package in Wallaroo Ops, and perform sample inferences. The filemodels/model-auto-conversion-BYOP-vgg16-clustering.zip
is provided so users can go right to testing deployment. - Publish pipeline to Open Container Initiative Registry, registered in the Wallaroo Ops instance as the Edge Deployment Registry.: This will containerize the pipeline and copy the engine, python steps, model, and deployment configuration to the registry service.
- Arbitrary Python Tutorial Deploy Model in Wallaroo Upload and Deploy: Deploys the
- In a remote aka edge device:
- Deploy the Pipeline to an Edge Device: The pipeline will be deployed to an Edge device as a remote Wallaroo Inference Server through Docker.
Arbitrary Python Script Requirements
The entry point of the arbitrary python model is any python script that must include the following.
class ImageClustering(Inference)
: The default inference class. This is used to perform the actual inferences. Wallaroo uses the_predict
method to receive the inference data and call the appropriate functions for the inference.def __init__
: Used to initialize this class and load in any other classes or other required settings.def expected_model_types
: Used by Wallaroo to anticipate what model types are used by the script.def model(self, model)
: Defines the model used for the inference. Accepts the model instance used in the inference.self._raise_error_if_model_is_wrong_type(model)
: Returns the error if the wrong model type is used. This verifies that only the anticipated model type is used for the inference.self._model = model
: Sets the submitted model as the model for this class, provided_raise_error_if_model_is_wrong_type
is not raised.
def _predict(self, input_data: InferenceData)
: This is the entry point for Wallaroo to perform the inference. This will receive the inference data, then perform whatever steps and return a dictionary of numpy arrays.
class ImageClusteringBuilder(InferenceBuilder)
: Loads the model and prepares it for inferencing.def inference(self) -> ImageClustering
: Sets the inference class being used for the inferences.def create(self, config: CustomInferenceConfig) -> ImageClustering
: Creates an inference subclass, assigning the model and any attributes required for it to function.
All other methods used for the functioning of these classes are optional, as long as they meet the requirements listed above.
References
Wallaroo SDK Essentials Guide: Model Uploads and Registrations: Arbitrary Python
Prerequisites
A deployed Wallaroo Ops instance.
A location with Docker or Kubernetes with
helm
for Wallaroo Inference server deployments.The following Python libraries installed:
Tutorial Steps
Import Libraries
The first step is to import the libraries we’ll be using. These are included by default in the Wallaroo instance’s JupyterHub service.
import numpy as np
import pandas as pd
import json
import pyarrow as pa
import wallaroo
from wallaroo.pipeline import Pipeline
from wallaroo.deployment_config import DeploymentConfigBuilder
from wallaroo.framework import Framework
from wallaroo.object import EntityNotFoundError
import requests
Open a Connection to Wallaroo
The next step is connect to Wallaroo through the Wallaroo client. The Python library is included in the Wallaroo install and available through the Jupyter Hub interface provided with your Wallaroo environment.
This is accomplished using the wallaroo.Client()
command, which provides a URL to grant the SDK permission to your specific Wallaroo environment. When displayed, enter the URL into a browser and confirm permissions. Store the connection into a variable that can be referenced later.
If logging into the Wallaroo instance through the internal JupyterHub service, use wl = wallaroo.Client()
. For more details on logging in through Wallaroo, see the Wallaroo SDK Essentials Guide: Client Connection.
wl = wallaroo.Client()
ERROR:root:Keycloak token refresh got error: 400 - {"error":"invalid_grant","error_description":"Invalid refresh token"}
Set Variables
We’ll set the name of our workspace, pipeline, models and files. Workspace names must be unique across the Wallaroo workspace. For this, we’ll add in a randomly generated 4 characters to the workspace name to prevent collisions with other users’ workspaces. If running this tutorial, we recommend hard coding the workspace name so it will function in the same workspace each time it’s run.
workspace_name = f'vgg16-clustering-workspace'
pipeline_name = f'vgg16-clustering-pipeline'
model_name = 'vgg16-clustering'
model_file_name = './models/model-auto-conversion-BYOP-vgg16-clustering.zip'
Create Workspace and Pipeline
We will now create the Wallaroo workspace to store our model and set it as the current workspace. Future commands will default to this workspace for pipeline creation, model uploads, etc. We’ll create our Wallaroo pipeline that is used to deploy our arbitrary Python model.
workspace = wl.get_workspace(name=workspace_name, create_if_not_exist=True)
wl.set_current_workspace(workspace)
pipeline = wl.build_pipeline(pipeline_name)
Upload Arbitrary Python Model
Arbitrary Python models are uploaded to Wallaroo through the Wallaroo Client upload_model
method.
Upload Arbitrary Python Model Parameters
The following parameters are required for Arbitrary Python models. Note that while some fields are considered as optional for the upload_model
method, they are required for proper uploading of a Arbitrary Python model to Wallaroo.
Parameter | Type | Description |
---|---|---|
name | string (Required) | The name of the model. Model names are unique per workspace. Models that are uploaded with the same name are assigned as a new version of the model. |
path | string (Required) | The path to the model file being uploaded. |
framework | string (Upload Method Optional, Arbitrary Python model Required) | Set as Framework.CUSTOM . |
input_schema | pyarrow.lib.Schema (Upload Method Optional, Arbitrary Python model Required) | The input schema in Apache Arrow schema format. |
output_schema | pyarrow.lib.Schema (Upload Method Optional, Arbitrary Python model Required) | The output schema in Apache Arrow schema format. |
convert_wait | bool (Upload Method Optional, Arbitrary Python model Optional) (Default: True) |
|
Once the upload process starts, the model is containerized by the Wallaroo instance. This process may take up to 10 minutes.
Upload Arbitrary Python Model Return
The following is returned with a successful model upload and conversion.
Field | Type | Description |
---|---|---|
name | string | The name of the model. |
version | string | The model version as a unique UUID. |
file_name | string | The file name of the model as stored in Wallaroo. |
image_path | string | The image used to deploy the model in the Wallaroo engine. |
last_update_time | DateTime | When the model was last updated. |
For our example, we’ll start with setting the input_schema
and output_schema
that is expected by our ImageClustering._predict()
method.
input_schema = pa.schema([
pa.field('images', pa.list_(
pa.list_(
pa.list_(
pa.int64(),
list_size=3
),
list_size=32
),
list_size=32
)),
])
output_schema = pa.schema([
pa.field('predictions', pa.int64()),
])
Upload Model
Now we’ll upload our model. The framework is Framework.CUSTOM
for arbitrary Python models, and we’ll specify the input and output schemas for the upload.
model = wl.upload_model(model_name,
model_file_name,
framework=Framework.CUSTOM,
input_schema=input_schema,
output_schema=output_schema,
convert_wait=False)
# time to finish the auto-packaging
import time
time.sleep(120)
Once the model is uploaded, we wait for the auto-packaging process to complete. We retrieve the model with wallaroo.client.Client.get_model
which accepts the model name, and returns the latest version of the model.
model = wl.get_model(model_name)
model
Name | vgg16-clustering |
Version | 1e557953-2fc7-4258-a851-3042adbe913a |
File Name | model-auto-conversion-BYOP-vgg16-clustering.zip |
SHA | 7bb3362b1768c92ea7e593451b2b8913d3b7616c19fd8d25b73fb6990f9283e0 |
Status | ready |
Image Path | proxy.replicated.com/proxy/wallaroo/ghcr.io/wallaroolabs/mac-deploy:v2024.1.0-main-4963 |
Architecture | x86 |
Acceleration | none |
Updated At | 2024-22-Apr 16:41:43 |
Deploy Pipeline
The model is uploaded and ready for use. We’ll add it as a step in our pipeline, then deploy the pipeline. For this example we’re allocated 0.25 cpu and 4 Gi RAM to the pipeline through the pipeline’s deployment configuration.
# clear if used before
pipeline.clear()
pipeline.add_model_step(model)
name | vgg16-clustering-pipeline |
---|---|
created | 2024-04-22 16:17:08.651909+00:00 |
last_updated | 2024-04-22 16:38:12.074544+00:00 |
deployed | True |
arch | x86 |
accel | none |
tags | |
versions | 412b8da5-ad4c-417c-9f6e-ad79d71522a4, 4233c4e7-517a-48e8-807a-b626834f45ec, 4ca1d45a-507d-42e2-8038-d608c543681a, a99f0a28-ad9e-4db3-9eea-113bdd9ca1cd, be19886c-3896-47d5-9935-35592f44ad7c |
steps | vgg16-clustering |
published | False |
deployment_config = DeploymentConfigBuilder() \
.cpus(1).memory('4Gi') \
.build()
pipeline.deploy(deployment_config=deployment_config)
name | vgg16-clustering-pipeline |
---|---|
created | 2024-04-22 16:17:08.651909+00:00 |
last_updated | 2024-04-22 16:43:31.697272+00:00 |
deployed | True |
arch | x86 |
accel | none |
tags | |
versions | 29d94f80-3c21-44fb-9e71-a5498c3bce3d, 412b8da5-ad4c-417c-9f6e-ad79d71522a4, 4233c4e7-517a-48e8-807a-b626834f45ec, 4ca1d45a-507d-42e2-8038-d608c543681a, a99f0a28-ad9e-4db3-9eea-113bdd9ca1cd, be19886c-3896-47d5-9935-35592f44ad7c |
steps | vgg16-clustering |
published | False |
Run inference
Everything is in place - we’ll now run a sample inference with some toy data. In this case we’re randomly generating some values in the data shape the model expects, then submitting an inference request through our deployed pipeline.
deploy_url = pipeline._deployment._url()
headers = wl.auth.auth_header()
headers['Content-Type']='application/json; format=pandas-records'
headers['Accept']='application/json; format=pandas-records'
dataFile = './data/vgg16_test.df.json'
# inference through Pipeline Deploy URL
!curl -X POST {deploy_url} \
-H "Authorization:{headers['Authorization']}" \
-H "Content-Type:{headers['Content-Type']}" \
-H "Accept:{headers['Accept']}" \
--data @{dataFile}
[{"time":1713804243509,"in":{"images":[23,109,44,60,212,137,45,255,159,203,92,99,75,244,173,169,213,186,247,81,161,135,206,44,150,191,1,73,60,210,61,198,189,3,27,29,225,138,32,184,1,88,137,36,207,149,212,226,114,173,4,68,226,177,254,75,105,51,29,168,119,230,221,128,1,135,104,246,46,164,69,120,21,98,143,173,113,167,100,71,128,119,162,98,191,108,102,103,180,246,155,13,9,214,67,7,81,189,166,182,5,229,242,143,42,237,179,142,116,51,0,205,150,204,43,173,219,249,105,105,234,196,132,45,195,248,208,135,154,254,5,244,48,169,227,9,164,72,92,36,203,162,165,155,64,77,242,110,14,44,238,197,203,159,190,205,9,6,247,34,58,38,171,237,228,15,244,79,147,97,81,199,251,244,89,156,154,96,125,45,91,26,147,40,186,91,252,213,113,13,168,130,61,217,10,252,115,167,163,66,246,98,24,120,46,255,249,56,37,65,222,206,185,39,54,154,26,123,93,95,38,34,197,24,149,212,120,170,87,11,1,29,84,244,101,117,51,53,196,8,201,127,232,117,128,63,138,60,59,65,25,153,160,52,21,251,186,63,143,36,196,128,136,206,31,249,122,70,167,245,78,144,245,0,19,186,116,222,120,28,237,6,102,158,203,113,89,224,161,51,114,26,172,231,70,213,42,217,101,79,246,79,177,137,195,222,25,213,162,87,185,109,225,137,97,149,195,31,57,135,127,76,163,246,180,106,93,29,182,189,244,251,2,227,118,72,183,129,203,161,105,124,156,212,30,167,250,225,3,164,70,41,212,171,60,26,5,6,98,218,120,113,11,231,0,167,136,34,142,59,166,198,118,130,15,169,158,235,117,0,70,246,131,85,171,206,220,202,153,45,252,136,123,210,163,177,60,118,124,138,53,255,126,26,173,121,45,115,103,202,108,176,47,93,85,159,133,145,11,190,73,191,106,89,46,63,164,142,5,26,150,140,167,62,128,71,170,2,145,173,113,18,125,70,15,179,121,165,176,120,84,249,1,104,15,75,99,15,249,114,8,103,18,191,30,108,243,145,26,4,173,231,254,120,220,8,8,110,244,71,91,154,85,251,101,90,68,52,12,209,8,15,84,103,136,32,189,187,34,58,220,168,188,51,134,16,172,107,243,162,181,29,91,109,56,4,177,179,55,147,29,139,161,7,181,161,24,211,247,102,117,213,222,71,26,23,196,111,164,200,97,60,163,229,9,38,44,9,214,36,7,149,112,21,84,223,41,133,75,35,189,144,67,43,199,38,4,168,70,219,73,195,115,95,80,120,128,247,115,46,184,4,211,115,49,99,147,145,10,10,168,32,101,116,181,128,56,17,133,185,13,39,109,230,239,65,142,235,6,74,13,55,208,239,104,171,117,40,59,182,150,184,97,4,197,206,227,24,188,246,108,37,68,221,217,69,142,113,220,147,51,47,146,194,127,67,99,145,176,86,129,54,237,143,86,209,116,209,235,24,59,134,69,67,95,130,227,150,93,187,230,119,85,132,50,41,203,148,182,221,186,113,214,105,38,154,134,177,117,228,144,233,76,61,223,6,142,187,129,56,208,152,86,206,28,180,172,66,40,102,162,107,219,34,87,241,165,73,160,175,158,33,67,34,155,250,173,231,250,18,227,67,251,21,208,116,198,135,143,133,99,176,227,106,62,145,161,152,39,105,56,185,111,234,225,28,188,142,251,164,205,68,249,235,54,246,63,11,124,158,58,31,189,137,49,229,59,68,143,85,114,79,9,131,16,113,114,91,93,248,20,225,159,94,237,130,117,129,79,50,176,104,76,27,254,148,155,41,143,148,117,159,44,57,15,252,120,183,245,104,247,130,3,72,69,195,41,24,180,73,243,148,16,241,8,102,115,223,161,138,102,9,1,15,97,206,71,238,164,174,11,30,184,216,62,255,118,7,97,185,59,96,72,26,130,127,104,143,211,67,191,81,99,164,231,67,142,84,140,96,19,98,155,143,72,178,101,181,131,113,16,239,117,111,207,91,162,145,68,52,163,146,216,212,29,146,46,206,116,235,12,80,75,156,236,11,146,235,10,195,150,91,107,47,194,237,198,157,166,29,194,202,13,95,151,232,20,180,10,65,224,84,127,218,60,153,74,44,180,217,203,159,220,250,36,137,212,242,47,239,188,44,195,131,233,233,55,146,7,95,105,12,50,246,130,146,112,205,36,18,92,209,85,210,94,181,73,4,212,233,205,89,249,239,50,254,92,39,73,69,251,255,100,15,99,147,226,59,2,100,214,219,43,107,100,99,60,210,178,78,131,208,144,28,213,49,180,59,86,214,20,10,45,22,45,39,18,61,47,207,101,174,161,58,126,212,109,87,199,92,134,100,73,139,137,71,46,20,177,28,86,172,221,79,121,147,252,219,215,139,213,197,197,9,171,160,202,3,55,134,151,116,16,79,229,18,182,134,197,219,169,53,230,36,65,109,254,84,163,100,81,31,130,63,188,15,126,129,99,100,134,43,23,92,48,100,102,126,215,144,48,157,31,125,232,183,192,174,51,98,231,165,73,81,104,91,164,3,75,108,170,138,115,210,155,183,142,200,176,223,138,120,104,239,85,62,147,53,50,130,25,9,118,64,21,90,134,33,5,143,240,203,38,229,23,116,120,240,119,237,123,58,111,34,9,156,181,118,194,212,155,35,242,72,13,57,22,63,179,154,129,168,79,197,200,186,58,67,91,187,91,66,72,47,189,214,253,230,167,90,0,70,190,149,19,64,94,195,6,230,110,177,190,13,173,91,82,142,172,205,7,56,249,77,243,141,189,12,88,65,251,175,4,191,203,110,102,39,95,173,207,167,209,26,255,22,131,163,239,215,200,137,190,226,209,185,236,104,242,255,64,1,200,119,42,59,65,206,57,107,21,90,20,87,145,158,221,62,124,81,214,129,138,72,104,174,177,210,246,254,242,58,119,73,53,142,91,173,40,56,155,5,90,51,55,163,60,187,152,13,85,50,82,223,51,184,92,175,31,239,238,72,43,243,134,248,77,247,220,35,136,147,228,79,141,21,162,18,186,213,74,13,133,63,113,167,97,156,68,200,61,35,22,78,138,123,184,232,139,194,59,252,94,161,34,60,74,136,116,182,7,7,146,182,222,0,153,51,207,146,198,83,44,82,238,38,204,65,240,200,200,245,205,209,124,64,241,21,50,97,12,151,139,115,242,44,205,26,44,96,153,183,60,195,78,216,155,147,137,71,99,193,91,76,42,206,166,86,77,38,25,79,35,216,85,92,218,148,255,76,150,65,139,109,69,53,4,245,169,169,34,240,228,54,135,126,174,178,61,190,165,118,16,195,71,89,251,247,77,115,150,151,72,18,0,204,198,80,253,15,56,227,9,142,246,142,164,237,202,5,153,231,92,131,11,125,100,174,162,194,238,110,143,127,198,55,3,210,24,54,33,210,239,63,184,170,45,202,39,172,68,231,93,76,233,73,83,178,249,43,78,19,93,195,144,96,152,31,34,25,71,154,143,119,253,113,98,130,97,161,173,173,152,17,77,130,118,21,163,189,59,135,68,59,173,208,79,47,145,46,136,255,198,243,57,88,222,3,52,250,84,126,176,67,239,1,43,87,156,93,166,98,24,141,220,145,54,214,201,138,68,69,150,167,14,205,4,194,13,66,174,128,109,235,203,139,135,85,0,105,249,100,205,89,250,207,204,129,16,194,9,134,72,5,184,246,122,139,98,50,149,152,174,50,97,114,231,100,16,74,31,73,248,11,30,150,233,170,160,170,74,207,46,99,183,247,222,103,107,186,226,174,36,63,17,234,107,148,6,35,104,193,136,88,51,204,222,142,109,57,4,6,108,180,125,219,113,53,228,149,168,142,198,4,206,195,183,231,94,78,87,184,178,227,106,112,70,136,51,68,50,238,130,231,236,117,154,241,13,16,217,125,110,147,188,31,184,8,60,30,147,233,202,244,192,46,2,25,155,11,169,32,217,130,112,137,128,114,5,148,73,47,97,199,157,226,210,211,73,223,242,19,72,237,184,238,185,79,167,47,163,98,115,190,28,209,221,173,243,172,197,45,28,39,81,76,34,216,200,28,76,167,79,241,53,227,208,11,16,194,21,244,165,210,168,168,104,219,235,199,143,152,193,226,232,209,57,82,103,135,24,252,15,215,80,136,190,147,29,107,57,226,213,56,170,202,97,22,185,34,186,89,152,234,87,52,223,194,88,90,104,82,18,167,55,254,249,222,195,130,109,54,162,5,45,7,233,46,150,166,201,221,135,209,162,182,91,107,42,196,40,192,84,248,191,84,166,176,6,212,149,138,170,59,90,68,200,245,59,243,164,1,210,83,177,182,120,18,200,157,226,81,241,124,151,79,126,216,153,137,20,241,182,249,231,241,81,6,226,129,24,53,81,100,238,162,31,235,67,132,106,57,163,28,178,143,62,9,182,154,5,243,83,170,19,126,140,36,216,245,22,188,91,243,127,117,39,167,133,134,186,253,247,46,198,135,232,92,251,200,9,247,126,223,142,190,206,111,9,96,73,149,129,32,99,20,61,67,182,238,234,9,203,57,228,144,138,133,137,94,214,175,226,112,48,69,130,37,78,142,124,25,79,72,30,94,251,84,93,34,32,156,139,174,6,37,133,179,112,128,130,46,13,121,148,33,121,62,30,48,114,56,132,146,180,92,140,3,82,104,138,232,20,128,81,118,182,174,113,30,106,224,107,146,38,218,236,6,42,187,228,253,18,137,32,243,129,30,78,5,190,16,84,75,232,116,193,87,206,187,185,28,234,218,59,93,173,99,228,108,44,150,185,238,86,78,162,254,133,98,112,202,205,96,145,169,5,227,231,160,140,84,69,38,95,146,238,245,96,237,204,210,45,186,200,184,32,68,224,76,65,205,146,18,74,134,42,226,171,138,62,205,104,200,202,192,26,37,30,210,157,202,21,72,138,198,107,81,177,243,33,226,91,82,210,52,110,124,38,229,54,247,157,238,14,244,149,85,22,168,163,98,165,31,181,174,170,34,50,235,120,88,24,100,214,153,64,154,98,139,10,74,33,93,68,203,254,53,221,201,147,36,180,157,77,52,102,239,32,62,243,50,28,222,25,16,93,185,92,194,10,192,130,126,165,193,71,108,234,210,111,151,54,91,8,150,95,253,199,138,76,98,22,211,217,120,190,198,74,9,221,135,69,240,56,246,227,158,89,114,212,154,188,190,119,144,71,137,1,186,217,56,29,108,63,208,104,79,28,208,164,37,126,170,50,52,48,154,135,57,4,204,61,95,230,149,147,26,88,80,95,194,37,195,250,1,116,121,174,53,101,197,89,95,23,143,27,181,188,133,247,36,106,237,55,194,135,39,243,119,139,190,128,143,255,51,60,54,255,71,87,16,146,11,106,87,167,78,63,217,68,128,156,66,94,118,158,140,9,247,161,197,229,5,89,41,35,188,132,225,34,32,228,149,210,244,154,218,0,215,192,4,206,1,169,113,208,90,36,238,137,104,61,10,196,109,33,53,46,84,114,195,225,52,235,205,193,157,21,38,111,94,26,243,113,44,41,67,42,195,221,189,72,58,201,222,182,223,128,124,158,28,35,212,76,237,202,6,252,240,235,23,56,123,155,62,71,198,52,114,70,218,100,141,5,187,0,251,121,117,17,19,158,29,209,76,160,155,182,61,142,108,178,238,151,24,49,89,170,196,137,177,191,107,25,70,66,244,243,100,31,88,225,244,5,244,193,166,123,115,174,38,122,239,169,146,229,228,41,241,12,89,235,196,187,21,87,199,234,165,125,102,136,76,38,208,10,234,171,80,126,152,252,68,36,3,12,108,112,236,159,10,148,8,173,212,129,110,173,136,187,236,60,61,209,131,251,218,20,216,116,23,43,195,193,156,183,37,11,1,11,223,241,26,13,169,23,66,139,208,62,76,149,84,133,217,119,254,247,187,217,76,252,82,94,82,20,220,170,177,245,1,93,50,173,110,150,17,16,52,79,16,54,102,1,184,138,50,100,92,84,39,213,66,203,255,114,143,65,149,244,19,175,223,248,46,191,149,45,159,161,239,59,146,4,56,57,199,160,234,230,2,26,98,234,190,143,30,4,206,160,150,142,5,238,131,198,113,107,41,242,240,96,44,199,149,0,57,55,142,87,248,190,109,252,107,114,244,185,5,42,234,144,193,20,19,78,237,191,132,189,205,242,245,225,31,130,247,31,222,155,24,81,66,64,86,17,241,161,209,237,128,251,66,2,80,241,148,40,133,246,28,215,7,79,112,200,252,109,73,251,157,210,59,90,213,40,32,110,65,0,90,96,124,255,244,174,20,252,58,81,233,61,213,222,191,216,156,238,18,204,76,212,238,74,222,92,231,251,14,234,16,244,180,15,42,160,245,37,142,242,34,16,203,21,233,205,188,2,217,7,237,111,16,135,232,210,223,3,143,57,88,241,14,47,187,219,197,51,211,29,145,32,85,184,210,137,155,235,47,138,6,23,156,238,168,216,61,217,48,11,96,227,213,5,235,222,228,196,23,1,124,51,105,60,115,216,8,175,156,178,75,216,234,9,40,154,230,128,88,58,130,197,254,122,8,82,254,255,250,243,225,232,77,48,17,228,59,0,140,36,216,158,100,160,246,53,3,87,222,231,112,121,227,138,108,9,119,235,203,78,123,191,250,126,2,107,17,34,229,181,201,206,213,106,166,154,173,175,233,191,95,43,204,177,239,21,74,79,144,150,208,65,188,24,185,98,77,25,126,93,177,69,255,172,166,193,102,139,6,241,95,250,173,9,60,95,27,190,158,170,248,16,104,23,250,154,153,111,159,184,17,93,100,113,136,248,246,203,50,210,21,136,114,39,137,120,71,9,130,195,13,165,11,236,142,142,114,99,168,195,57]},"out":{"predictions":1},"anomaly":{"count":0},"metadata":{"last_model":"{\"model_name\":\"vgg16-clustering\",\"model_sha\":\"7bb3362b1768c92ea7e593451b2b8913d3b7616c19fd8d25b73fb6990f9283e0\"}","pipeline_version":"29d94f80-3c21-44fb-9e71-a5498c3bce3d","elapsed":[853071,33941691],"dropped":[],"partition":"engine-67755f94f5-rxrtc"}},{"time":1713804243509,"in":{"images":[23,109,44,60,212,137,45,255,159,203,92,99,75,244,173,169,213,186,247,81,161,135,206,44,150,191,1,73,60,210,61,198,189,3,27,29,225,138,32,184,1,88,137,36,207,149,212,226,114,173,4,68,226,177,254,75,105,51,29,168,119,230,221,128,1,135,104,246,46,164,69,120,21,98,143,173,113,167,100,71,128,119,162,98,191,108,102,103,180,246,155,13,9,214,67,7,81,189,166,182,5,229,242,143,42,237,179,142,116,51,0,205,150,204,43,173,219,249,105,105,234,196,132,45,195,248,208,135,154,254,5,244,48,169,227,9,164,72,92,36,203,162,165,155,64,77,242,110,14,44,238,197,203,159,190,205,9,6,247,34,58,38,171,237,228,15,244,79,147,97,81,199,251,244,89,156,154,96,125,45,91,26,147,40,186,91,252,213,113,13,168,130,61,217,10,252,115,167,163,66,246,98,24,120,46,255,249,56,37,65,222,206,185,39,54,154,26,123,93,95,38,34,197,24,149,212,120,170,87,11,1,29,84,244,101,117,51,53,196,8,201,127,232,117,128,63,138,60,59,65,25,153,160,52,21,251,186,63,143,36,196,128,136,206,31,249,122,70,167,245,78,144,245,0,19,186,116,222,120,28,237,6,102,158,203,113,89,224,161,51,114,26,172,231,70,213,42,217,101,79,246,79,177,137,195,222,25,213,162,87,185,109,225,137,97,149,195,31,57,135,127,76,163,246,180,106,93,29,182,189,244,251,2,227,118,72,183,129,203,161,105,124,156,212,30,167,250,225,3,164,70,41,212,171,60,26,5,6,98,218,120,113,11,231,0,167,136,34,142,59,166,198,118,130,15,169,158,235,117,0,70,246,131,85,171,206,220,202,153,45,252,136,123,210,163,177,60,118,124,138,53,255,126,26,173,121,45,115,103,202,108,176,47,93,85,159,133,145,11,190,73,191,106,89,46,63,164,142,5,26,150,140,167,62,128,71,170,2,145,173,113,18,125,70,15,179,121,165,176,120,84,249,1,104,15,75,99,15,249,114,8,103,18,191,30,108,243,145,26,4,173,231,254,120,220,8,8,110,244,71,91,154,85,251,101,90,68,52,12,209,8,15,84,103,136,32,189,187,34,58,220,168,188,51,134,16,172,107,243,162,181,29,91,109,56,4,177,179,55,147,29,139,161,7,181,161,24,211,247,102,117,213,222,71,26,23,196,111,164,200,97,60,163,229,9,38,44,9,214,36,7,149,112,21,84,223,41,133,75,35,189,144,67,43,199,38,4,168,70,219,73,195,115,95,80,120,128,247,115,46,184,4,211,115,49,99,147,145,10,10,168,32,101,116,181,128,56,17,133,185,13,39,109,230,239,65,142,235,6,74,13,55,208,239,104,171,117,40,59,182,150,184,97,4,197,206,227,24,188,246,108,37,68,221,217,69,142,113,220,147,51,47,146,194,127,67,99,145,176,86,129,54,237,143,86,209,116,209,235,24,59,134,69,67,95,130,227,150,93,187,230,119,85,132,50,41,203,148,182,221,186,113,214,105,38,154,134,177,117,228,144,233,76,61,223,6,142,187,129,56,208,152,86,206,28,180,172,66,40,102,162,107,219,34,87,241,165,73,160,175,158,33,67,34,155,250,173,231,250,18,227,67,251,21,208,116,198,135,143,133,99,176,227,106,62,145,161,152,39,105,56,185,111,234,225,28,188,142,251,164,205,68,249,235,54,246,63,11,124,158,58,31,189,137,49,229,59,68,143,85,114,79,9,131,16,113,114,91,93,248,20,225,159,94,237,130,117,129,79,50,176,104,76,27,254,148,155,41,143,148,117,159,44,57,15,252,120,183,245,104,247,130,3,72,69,195,41,24,180,73,243,148,16,241,8,102,115,223,161,138,102,9,1,15,97,206,71,238,164,174,11,30,184,216,62,255,118,7,97,185,59,96,72,26,130,127,104,143,211,67,191,81,99,164,231,67,142,84,140,96,19,98,155,143,72,178,101,181,131,113,16,239,117,111,207,91,162,145,68,52,163,146,216,212,29,146,46,206,116,235,12,80,75,156,236,11,146,235,10,195,150,91,107,47,194,237,198,157,166,29,194,202,13,95,151,232,20,180,10,65,224,84,127,218,60,153,74,44,180,217,203,159,220,250,36,137,212,242,47,239,188,44,195,131,233,233,55,146,7,95,105,12,50,246,130,146,112,205,36,18,92,209,85,210,94,181,73,4,212,233,205,89,249,239,50,254,92,39,73,69,251,255,100,15,99,147,226,59,2,100,214,219,43,107,100,99,60,210,178,78,131,208,144,28,213,49,180,59,86,214,20,10,45,22,45,39,18,61,47,207,101,174,161,58,126,212,109,87,199,92,134,100,73,139,137,71,46,20,177,28,86,172,221,79,121,147,252,219,215,139,213,197,197,9,171,160,202,3,55,134,151,116,16,79,229,18,182,134,197,219,169,53,230,36,65,109,254,84,163,100,81,31,130,63,188,15,126,129,99,100,134,43,23,92,48,100,102,126,215,144,48,157,31,125,232,183,192,174,51,98,231,165,73,81,104,91,164,3,75,108,170,138,115,210,155,183,142,200,176,223,138,120,104,239,85,62,147,53,50,130,25,9,118,64,21,90,134,33,5,143,240,203,38,229,23,116,120,240,119,237,123,58,111,34,9,156,181,118,194,212,155,35,242,72,13,57,22,63,179,154,129,168,79,197,200,186,58,67,91,187,91,66,72,47,189,214,253,230,167,90,0,70,190,149,19,64,94,195,6,230,110,177,190,13,173,91,82,142,172,205,7,56,249,77,243,141,189,12,88,65,251,175,4,191,203,110,102,39,95,173,207,167,209,26,255,22,131,163,239,215,200,137,190,226,209,185,236,104,242,255,64,1,200,119,42,59,65,206,57,107,21,90,20,87,145,158,221,62,124,81,214,129,138,72,104,174,177,210,246,254,242,58,119,73,53,142,91,173,40,56,155,5,90,51,55,163,60,187,152,13,85,50,82,223,51,184,92,175,31,239,238,72,43,243,134,248,77,247,220,35,136,147,228,79,141,21,162,18,186,213,74,13,133,63,113,167,97,156,68,200,61,35,22,78,138,123,184,232,139,194,59,252,94,161,34,60,74,136,116,182,7,7,146,182,222,0,153,51,207,146,198,83,44,82,238,38,204,65,240,200,200,245,205,209,124,64,241,21,50,97,12,151,139,115,242,44,205,26,44,96,153,183,60,195,78,216,155,147,137,71,99,193,91,76,42,206,166,86,77,38,25,79,35,216,85,92,218,148,255,76,150,65,139,109,69,53,4,245,169,169,34,240,228,54,135,126,174,178,61,190,165,118,16,195,71,89,251,247,77,115,150,151,72,18,0,204,198,80,253,15,56,227,9,142,246,142,164,237,202,5,153,231,92,131,11,125,100,174,162,194,238,110,143,127,198,55,3,210,24,54,33,210,239,63,184,170,45,202,39,172,68,231,93,76,233,73,83,178,249,43,78,19,93,195,144,96,152,31,34,25,71,154,143,119,253,113,98,130,97,161,173,173,152,17,77,130,118,21,163,189,59,135,68,59,173,208,79,47,145,46,136,255,198,243,57,88,222,3,52,250,84,126,176,67,239,1,43,87,156,93,166,98,24,141,220,145,54,214,201,138,68,69,150,167,14,205,4,194,13,66,174,128,109,235,203,139,135,85,0,105,249,100,205,89,250,207,204,129,16,194,9,134,72,5,184,246,122,139,98,50,149,152,174,50,97,114,231,100,16,74,31,73,248,11,30,150,233,170,160,170,74,207,46,99,183,247,222,103,107,186,226,174,36,63,17,234,107,148,6,35,104,193,136,88,51,204,222,142,109,57,4,6,108,180,125,219,113,53,228,149,168,142,198,4,206,195,183,231,94,78,87,184,178,227,106,112,70,136,51,68,50,238,130,231,236,117,154,241,13,16,217,125,110,147,188,31,184,8,60,30,147,233,202,244,192,46,2,25,155,11,169,32,217,130,112,137,128,114,5,148,73,47,97,199,157,226,210,211,73,223,242,19,72,237,184,238,185,79,167,47,163,98,115,190,28,209,221,173,243,172,197,45,28,39,81,76,34,216,200,28,76,167,79,241,53,227,208,11,16,194,21,244,165,210,168,168,104,219,235,199,143,152,193,226,232,209,57,82,103,135,24,252,15,215,80,136,190,147,29,107,57,226,213,56,170,202,97,22,185,34,186,89,152,234,87,52,223,194,88,90,104,82,18,167,55,254,249,222,195,130,109,54,162,5,45,7,233,46,150,166,201,221,135,209,162,182,91,107,42,196,40,192,84,248,191,84,166,176,6,212,149,138,170,59,90,68,200,245,59,243,164,1,210,83,177,182,120,18,200,157,226,81,241,124,151,79,126,216,153,137,20,241,182,249,231,241,81,6,226,129,24,53,81,100,238,162,31,235,67,132,106,57,163,28,178,143,62,9,182,154,5,243,83,170,19,126,140,36,216,245,22,188,91,243,127,117,39,167,133,134,186,253,247,46,198,135,232,92,251,200,9,247,126,223,142,190,206,111,9,96,73,149,129,32,99,20,61,67,182,238,234,9,203,57,228,144,138,133,137,94,214,175,226,112,48,69,130,37,78,142,124,25,79,72,30,94,251,84,93,34,32,156,139,174,6,37,133,179,112,128,130,46,13,121,148,33,121,62,30,48,114,56,132,146,180,92,140,3,82,104,138,232,20,128,81,118,182,174,113,30,106,224,107,146,38,218,236,6,42,187,228,253,18,137,32,243,129,30,78,5,190,16,84,75,232,116,193,87,206,187,185,28,234,218,59,93,173,99,228,108,44,150,185,238,86,78,162,254,133,98,112,202,205,96,145,169,5,227,231,160,140,84,69,38,95,146,238,245,96,237,204,210,45,186,200,184,32,68,224,76,65,205,146,18,74,134,42,226,171,138,62,205,104,200,202,192,26,37,30,210,157,202,21,72,138,198,107,81,177,243,33,226,91,82,210,52,110,124,38,229,54,247,157,238,14,244,149,85,22,168,163,98,165,31,181,174,170,34,50,235,120,88,24,100,214,153,64,154,98,139,10,74,33,93,68,203,254,53,221,201,147,36,180,157,77,52,102,239,32,62,243,50,28,222,25,16,93,185,92,194,10,192,130,126,165,193,71,108,234,210,111,151,54,91,8,150,95,253,199,138,76,98,22,211,217,120,190,198,74,9,221,135,69,240,56,246,227,158,89,114,212,154,188,190,119,144,71,137,1,186,217,56,29,108,63,208,104,79,28,208,164,37,126,170,50,52,48,154,135,57,4,204,61,95,230,149,147,26,88,80,95,194,37,195,250,1,116,121,174,53,101,197,89,95,23,143,27,181,188,133,247,36,106,237,55,194,135,39,243,119,139,190,128,143,255,51,60,54,255,71,87,16,146,11,106,87,167,78,63,217,68,128,156,66,94,118,158,140,9,247,161,197,229,5,89,41,35,188,132,225,34,32,228,149,210,244,154,218,0,215,192,4,206,1,169,113,208,90,36,238,137,104,61,10,196,109,33,53,46,84,114,195,225,52,235,205,193,157,21,38,111,94,26,243,113,44,41,67,42,195,221,189,72,58,201,222,182,223,128,124,158,28,35,212,76,237,202,6,252,240,235,23,56,123,155,62,71,198,52,114,70,218,100,141,5,187,0,251,121,117,17,19,158,29,209,76,160,155,182,61,142,108,178,238,151,24,49,89,170,196,137,177,191,107,25,70,66,244,243,100,31,88,225,244,5,244,193,166,123,115,174,38,122,239,169,146,229,228,41,241,12,89,235,196,187,21,87,199,234,165,125,102,136,76,38,208,10,234,171,80,126,152,252,68,36,3,12,108,112,236,159,10,148,8,173,212,129,110,173,136,187,236,60,61,209,131,251,218,20,216,116,23,43,195,193,156,183,37,11,1,11,223,241,26,13,169,23,66,139,208,62,76,149,84,133,217,119,254,247,187,217,76,252,82,94,82,20,220,170,177,245,1,93,50,173,110,150,17,16,52,79,16,54,102,1,184,138,50,100,92,84,39,213,66,203,255,114,143,65,149,244,19,175,223,248,46,191,149,45,159,161,239,59,146,4,56,57,199,160,234,230,2,26,98,234,190,143,30,4,206,160,150,142,5,238,131,198,113,107,41,242,240,96,44,199,149,0,57,55,142,87,248,190,109,252,107,114,244,185,5,42,234,144,193,20,19,78,237,191,132,189,205,242,245,225,31,130,247,31,222,155,24,81,66,64,86,17,241,161,209,237,128,251,66,2,80,241,148,40,133,246,28,215,7,79,112,200,252,109,73,251,157,210,59,90,213,40,32,110,65,0,90,96,124,255,244,174,20,252,58,81,233,61,213,222,191,216,156,238,18,204,76,212,238,74,222,92,231,251,14,234,16,244,180,15,42,160,245,37,142,242,34,16,203,21,233,205,188,2,217,7,237,111,16,135,232,210,223,3,143,57,88,241,14,47,187,219,197,51,211,29,145,32,85,184,210,137,155,235,47,138,6,23,156,238,168,216,61,217,48,11,96,227,213,5,235,222,228,196,23,1,124,51,105,60,115,216,8,175,156,178,75,216,234,9,40,154,230,128,88,58,130,197,254,122,8,82,254,255,250,243,225,232,77,48,17,228,59,0,140,36,216,158,100,160,246,53,3,87,222,231,112,121,227,138,108,9,119,235,203,78,123,191,250,126,2,107,17,34,229,181,201,206,213,106,166,154,173,175,233,191,95,43,204,177,239,21,74,79,144,150,208,65,188,24,185,98,77,25,126,93,177,69,255,172,166,193,102,139,6,241,95,250,173,9,60,95,27,190,158,170,248,16,104,23,250,154,153,111,159,184,17,93,100,113,136,248,246,203,50,210,21,136,114,39,137,120,71,9,130,195,13,165,11,236,142,142,114,99,168,195,57]},"out":{"predictions":1},"anomaly":{"count":0},"metadata":{"last_model":"{\"model_name\":\"vgg16-clustering\",\"model_sha\":\"7bb3362b1768c92ea7e593451b2b8913d3b7616c19fd8d25b73fb6990f9283e0\"}","pipeline_version":"29d94f80-3c21-44fb-9e71-a5498c3bce3d","elapsed":[853071,33941691],"dropped":[],"partition":"engine-67755f94f5-rxrtc"}}]
Undeploy Pipelines
The inference is successful, so we will undeploy the pipeline and return the resources back to the cluster.
pipeline.undeploy()
name | vgg16-clustering-pipeline |
---|---|
created | 2024-04-22 16:17:08.651909+00:00 |
last_updated | 2024-04-22 16:43:31.697272+00:00 |
deployed | False |
arch | x86 |
accel | none |
tags | |
versions | 29d94f80-3c21-44fb-9e71-a5498c3bce3d, 412b8da5-ad4c-417c-9f6e-ad79d71522a4, 4233c4e7-517a-48e8-807a-b626834f45ec, 4ca1d45a-507d-42e2-8038-d608c543681a, a99f0a28-ad9e-4db3-9eea-113bdd9ca1cd, be19886c-3896-47d5-9935-35592f44ad7c |
steps | vgg16-clustering |
published | False |
Publish the Pipeline for Edge Deployment
It worked! For a demo, we’ll take working once as “tested”. So now that we’ve tested our pipeline, we are ready to publish it for edge deployment.
Publishing it means assembling all of the configuration files and model assets and pushing them to an Open Container Initiative (OCI) repository set in the Wallaroo instance as the Edge Registry service. DevOps engineers then retrieve that image and deploy it through Docker, Kubernetes, or similar deployments.
See Edge Deployment Registry Guide for details on adding an OCI Registry Service to Wallaroo as the Edge Deployment Registry.
This is done through the SDK command wallaroo.pipeline.publish(deployment_config)
which has the following parameters and returns.
Publish a Pipeline Parameters
The publish
method takes the following parameters. The containerized pipeline will be pushed to the Edge registry service with the model, pipeline configurations, and other artifacts needed to deploy the pipeline.
Parameter | Type | Description |
---|---|---|
deployment_config | wallaroo.deployment_config.DeploymentConfig (Optional) | Sets the pipeline deployment configuration. For example: For more information on pipeline deployment configuration, see the Wallaroo SDK Essentials Guide: Pipeline Deployment Configuration. |
Publish a Pipeline Returns
Field | Type | Description |
---|---|---|
id | integer | Numerical Wallaroo id of the published pipeline. |
pipeline version id | integer | Numerical Wallaroo id of the pipeline version published. |
status | string | The status of the pipeline publication. Values include:
|
Engine URL | string | The URL of the published pipeline engine in the edge registry. |
Pipeline URL | string | The URL of the published pipeline in the edge registry. |
Helm Chart URL | string | The URL of the helm chart for the published pipeline in the edge registry. |
Helm Chart Reference | string | The help chart reference. |
Helm Chart Version | string | The version of the Helm Chart of the published pipeline. This is also used as the Docker tag. |
Engine Config | wallaroo.deployment_config.DeploymentConfig | The pipeline configuration included with the published pipeline. |
Replaces | List | A list of any pipeline publishes replaced by this new publish. |
Docker Run | string | Template of commands for deploying via docker run . |
Helm Install | string | Template of commands for deploying via helm . |
Created At | DateTime | When the published pipeline was created. |
Updated At | DateTime | When the published pipeline was updated. |
Publish Example
We will now publish the pipeline to our Edge Deployment Registry with the pipeline.publish(deployment_config)
command. deployment_config
is an optional field that specifies the pipeline deployment. This can be overridden by the DevOps engineer during deployment.
pub = pipeline.publish(deployment_config)
pub
Waiting for pipeline publish... It may take up to 600 sec.
Pipeline is publishing............... Published.
ID | 4 | |
Pipeline Name | vgg16-clustering-pipeline | |
Pipeline Version | 7a7509d5-c30b-4f33-82ae-49deaf79dbd1 | |
Status | Published | |
Engine URL | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2024.1.0-main-4963 | |
Pipeline URL | ghcr.io/wallaroolabs/doc-samples/pipelines/vgg16-clustering-pipeline:7a7509d5-c30b-4f33-82ae-49deaf79dbd1 | |
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/vgg16-clustering-pipeline | |
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:0a68ac1fc42292263dad5e51431f59b859917357fdc2b8ab4c53f3e175180303 | |
Helm Chart Version | 0.0.1-7a7509d5-c30b-4f33-82ae-49deaf79dbd1 | |
Engine Config | {'engine': {'resources': {'limits': {'cpu': 1.0, 'memory': '512Mi'}, 'requests': {'cpu': 1.0, 'memory': '512Mi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}, 'engineAux': {'autoscale': {'type': 'none'}, 'images': {}}} | |
User Images | [] | |
Created By | john.hummel@wallaroo.ai | |
Created At | 2024-04-22 16:48:03.272169+00:00 | |
Updated At | 2024-04-22 16:48:03.272169+00:00 | |
Replaces | ||
Docker Run Command |
Note: Please set the EDGE_PORT , OCI_USERNAME , and OCI_PASSWORD environment variables. | |
Helm Install Command |
Note: Please set the HELM_INSTALL_NAME , HELM_INSTALL_NAMESPACE ,
OCI_USERNAME , and OCI_PASSWORD environment variables. |
List Published Pipeline
The method wallaroo.client.list_pipelines()
shows a list of all pipelines in the Wallaroo instance, and includes the published
field that indicates whether the pipeline was published to the registry (True
), or has not yet been published (False
).
wl.list_pipelines()
name | created | last_updated | deployed | arch | tags | versions | steps | published | |
---|---|---|---|---|---|---|---|---|---|
vgg16-clustering-pipeline | 2024-22-Apr 16:17:08 | 2024-22-Apr 16:48:01 | False | x86 | none | 7a7509d5-c30b-4f33-82ae-49deaf79dbd1, 29d94f80-3c21-44fb-9e71-a5498c3bce3d, 412b8da5-ad4c-417c-9f6e-ad79d71522a4, 4233c4e7-517a-48e8-807a-b626834f45ec, 4ca1d45a-507d-42e2-8038-d608c543681a, a99f0a28-ad9e-4db3-9eea-113bdd9ca1cd, be19886c-3896-47d5-9935-35592f44ad7c | vgg16-clustering | True | |
new-edge-inline-replacement | 2024-22-Apr 15:43:04 | 2024-22-Apr 15:44:46 | False | x86 | none | 455a7840-08c3-43bb-b6a6-7535894e6055, 5210e01e-6d0f-4cdc-92ea-d3499bcc42fc, d61fcf2d-95ad-41e7-9e53-50610d9e0419 | gbr-house-price-estimator | True | |
edge-inline-replacement-demon | 2024-22-Apr 15:27:36 | 2024-22-Apr 15:40:50 | False | x86 | none | c6a1e945-7de0-4f2c-addb-4f4746114a86, 0ad2e53e-6c00-4949-8bd4-08ae289430d5, 7c702eca-8acf-45e0-bdcd-bbb48a5102e5, 2ef51c5c-bc58-49b3-9ecf-9aa4bb0a0bae, fbc4bf00-d97f-4be1-a47c-85c788dd90d5 | xgb-house-price-estimator | True |
List Publishes from a Pipeline
All publishes created from a pipeline are displayed with the wallaroo.pipeline.publishes
method. The pipeline_version_id
is used to know what version of the pipeline was used in that specific publish. This allows for pipelines to be updated over time, and newer versions to be sent and tracked to the Edge Deployment Registry service.
List Publishes Parameters
N/A
List Publishes Returns
A List of the following fields:
Field | Type | Description |
---|---|---|
id | integer | Numerical Wallaroo id of the published pipeline. |
pipeline_version_id | integer | Numerical Wallaroo id of the pipeline version published. |
engine_url | string | The URL of the published pipeline engine in the edge registry. |
pipeline_url | string | The URL of the published pipeline in the edge registry. |
created_by | string | The email address of the user that published the pipeline. |
Created At | DateTime | When the published pipeline was created. |
Updated At | DateTime | When the published pipeline was updated. |
pipeline.publishes()
id | pipeline_version_name | engine_url | pipeline_url | created_by | created_at | updated_at |
---|---|---|---|---|---|---|
4 | 7a7509d5-c30b-4f33-82ae-49deaf79dbd1 | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2024.1.0-main-4963 | ghcr.io/wallaroolabs/doc-samples/pipelines/vgg16-clustering-pipeline:7a7509d5-c30b-4f33-82ae-49deaf79dbd1 | john.hummel@wallaroo.ai | 2024-22-Apr 16:48:03 | 2024-22-Apr 16:48:03 |
DevOps Deployment
We now have our pipeline published to our Edge Registry service. We can deploy this in a x86 environment running Docker that is logged into the same registry service that we deployed to.
For more details, check with the documentation on your artifact service. The following are provided for the three major cloud services:
- Set up authentication for Docker
- Authenticate with an Azure container registry
- Authenticating Amazon ECR Repositories for Docker CLI with Credential Helper
Once a pipeline is deployed to the Edge Registry service, it can be deployed in environments such as Docker, Kubernetes, or similar container running services by a DevOps engineer. For full details, see How to Publish and Deploy AI Workloads for For Edge/Multicloud Model Deployments. The pipeline publishes Docker Run Command
and Helm Install Command
provide templates for deployment.
Edge Deployed Pipeline API Endpoints
Once deployed, we can check the pipelines and models available. We’ll use a curl
command, but any HTTP based request will work the same way.
The endpoint /pipelines
returns:
- id (String): The name of the pipeline.
- status (String): The status as either
Running
, orError
if there are any issues.
For this example, the deployment is made on a machine called testboy.local
. Replace this URL with the URL of you edge deployment.
!curl testboy.local:8080/pipelines
{"pipelines":[{"id":"vgg16-clustering-pipeline","version":"7a7509d5-c30b-4f33-82ae-49deaf79dbd1","status":"Running"}]}
The endpoint /models
returns a List of models with the following fields:
- name (String): The model name.
- sha (String): The sha hash value of the ML model.
- status (String): The status of either Running or Error if there are any issues.
- version (String): The model version. This matches the version designation used by Wallaroo to track model versions in UUID format.
!curl testboy.local:8080/models
{"models":[{"sha":"7bb3362b1768c92ea7e593451b2b8913d3b7616c19fd8d25b73fb6990f9283e0","name":"vgg16-clustering","version":"1e557953-2fc7-4258-a851-3042adbe913a","status":"Running"}]}
Edge Inference Endpoint
The inference endpoint takes the following pattern:
/infer
: The inference endpoint remains the same regardless of the pipeline or models deployed. This allows publish replacements without altering the inference endpoint used by other applications.
Wallaroo inference endpoint URLs accept the following data inputs through the Content-Type
header:
Content-Type: application/vnd.apache.arrow.file
: For Apache Arrow tables.Content-Type: application/json; format=pandas-records
: For pandas DataFrame in record format.
Once deployed, we can perform an inference through the deployment URL.
The endpoint returns Content-Type: application/json; format=pandas-records
by default with the following fields:
- check_failures (List[Integer]): Whether any validation checks were triggered. For more information, see Wallaroo SDK Essentials Guide: Pipeline Management: Anomaly Testing.
- elapsed (List[Integer]): A list of time in nanoseconds for:
- [0] The time to serialize the input.
- [1…n] How long each step took.
- model_name (String): The name of the model used.
- model_version (String): The version of the model in UUID format.
- original_data: The original input data. Returns
null
if the input may be too long for a proper return. - outputs (List): The outputs of the inference result separated by data type, where each data type includes:
- data: The returned values.
- dim (List[Integer]): The dimension shape returned.
- v (Integer): The vector shape of the data.
- pipeline_name (String): The name of the pipeline.
- shadow_data: Any shadow deployed data inferences in the same format as outputs.
- time (Integer): The time since UNIX epoch.
# set the content type and accept headers
headers = {
'Content-Type': 'application/json; format=pandas-records'
}
dataFile = './data/vgg16_test.df.json'
!curl -X POST 'http://testboy.local:8080/infer' \
-H "Content-Type:{headers['Content-Type']}" \
--data @{dataFile}