This tutorial and the assets can be downloaded as part of the Wallaroo Tutorials repository.
Wallaroo pipeline publishes are containerized versions of the pipeline, models and model steps, and the inference engine published to an Open Container Initiative (OCI) Registry. Once published, they are used to deploy models to edge devices and used for inference requests.
Edge locations added to a pipeline published allow deployments on edge devices to connect with the Wallaroo Ops instance and transmit their inference results as part of the pipeline logs.
Pipeline publishes can be replaced by new pipeline publishes from the following sources:
For more information on pipeline inference logs, see Inference Logs.
This tutorial provides the following:
models/rf_model.onnx
: The champion model that predicts house prices.models/xgb_model.onnx
: A new challenger model that takes the same inputs as models/rf_model.onnx
and outputs house prices with a field of the same name.models/gbr_model.onnx
: A new challenger model that takes the same inputs as models/rf_model.onnx
and outputs house prices with a field of the same name.The following is used to set up the environment that is used for the pipeline publish replacement and in-line model updates on an edge tutorial.
In these steps, we will:
The first step will be to import our libraries, and set variables used through this tutorial.
import wallaroo
from wallaroo.object import EntityNotFoundError
from wallaroo.framework import Framework
from IPython.display import display
# used to display DataFrame information without truncating
from IPython.display import display
import pandas as pd
pd.set_option('display.max_colwidth', None)
pd.set_option('display.max_columns', None)
import json
import time
workspace_name = 'in-line-edge-replacement-demo'
# ignoring warnings for demonstration
import warnings
warnings.filterwarnings('ignore')
# used to display DataFrame information without truncating
from IPython.display import display
import pandas as pd
pd.set_option('display.max_colwidth', None)
pd.set_option('display.max_columns', None)
The first step is to 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 information on Wallaroo Client settings, see the Client Connection guide.
# Login through local Wallaroo instance
wl = wallaroo.Client()
We will create a workspace to manage our pipeline and models. The following variables will set the name of our sample workspace then set it as the current workspace.
Workspace names are unique across the Wallaroo instance. If a user requests a workspace they have not been granted access to, an error message is returned.
workspace = wl.get_workspace(name=workspace_name, create_if_not_exist=True)
wl.set_current_workspace(workspace)
{'name': 'in-line-edge-replacement-demo', 'id': 5, 'archived': False, 'created_by': '76b893ff-5c30-4f01-bd9e-9579a20fc4ea', 'created_at': '2024-04-22T15:27:33.76544+00:00', 'models': [], 'pipelines': []}
For our example, we will upload the champion model that has been trained to derive house prices from a variety of inputs. The model file is rf_model.onnx
, and is uploaded with the name rf-house-price-estimator
.
housing_model_control = (wl.upload_model("rf-house-price-estimator",
'./models/rf_model.onnx',
framework=Framework.ONNX)
.configure(tensor_fields=["tensor"])
)
This pipeline is made to be an example of an existing situation where a model is deployed and being used for inferences in a production environment. We’ll call it edge-inline-replacement-demonstration
, set housing_model_control
as a pipeline step, then run a sample inference.
mainpipeline = wl.build_pipeline('edge-inline-replacement-demon')
# undeploy if already created earlier
mainpipeline.undeploy()
# clear the steps if used before
mainpipeline.clear()
mainpipeline.add_model_step(housing_model_control)
name | edge-inline-replacement-demon |
---|---|
created | 2024-04-22 15:27:36.828826+00:00 |
last_updated | 2024-04-22 15:27:36.828826+00:00 |
deployed | (none) |
arch | None |
accel | None |
tags | |
versions | fbc4bf00-d97f-4be1-a47c-85c788dd90d5 |
steps | |
published | False |
#minimum deployment config
deploy_config = wallaroo.DeploymentConfigBuilder().replica_count(1).cpus(0.5).memory("1Gi").build()
mainpipeline.deploy(deployment_config = deploy_config)
name | edge-inline-replacement-demon |
---|---|
created | 2024-04-22 15:27:36.828826+00:00 |
last_updated | 2024-04-22 15:27:39.074449+00:00 |
deployed | True |
arch | x86 |
accel | none |
tags | |
versions | 2ef51c5c-bc58-49b3-9ecf-9aa4bb0a0bae, fbc4bf00-d97f-4be1-a47c-85c788dd90d5 |
steps | rf-house-price-estimator |
published | False |
We’ll use a single row inference request that should return a result of around $700k
.
normal_input = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]]})
result = mainpipeline.infer(normal_input)
display(result)
time | in.tensor | out.variable | anomaly.count | |
---|---|---|---|---|
0 | 2024-04-22 15:27:54.780 | [4.0, 2.5, 2900.0, 5505.0, 2.0, 0.0, 0.0, 3.0, 8.0, 2900.0, 0.0, 47.6063, -122.02, 2970.0, 5251.0, 12.0, 0.0, 0.0] | [718013.7] | 0 |
We can now deploy the original pipeline to an edge device. This will require the following steps:
Publishing the pipeline uses the pipeline wallaroo.pipeline.publish()
command. This requires that the Wallaroo Ops instance have Edge Registry Services enabled.
The following publishes the pipeline to the OCI registry and displays the container details. For more information, see Wallaroo SDK Essentials Guide: Pipeline Edge Publication.
pub = mainpipeline.publish()
Waiting for pipeline publish... It may take up to 600 sec.
Pipeline is publishing....... Published.
The edge location is added with the wallaroo.pipeline_publish.add_edge(name)
method. This returns the OCI registration information, and the EDGE_BUNDLE
information. The EDGE_BUNDLE
data is a base64 encoded set of parameters for the pipeline that the edge device is associated with, the workspace, and other data.
For full details, see Wallaroo SDK Essentials Guide: Pipeline Edge Publication: Edge Observability.
For this example, we will add two locations:
houseprice-edge-inline-demo
These will be used in later steps for demonstrating inferences through different locations.
edge_name_01 = "houseprice-edge-inline-demonstration"
edge_publish_01 = pub.add_edge(edge_name_01)
display(edge_publish_01)
ID | 1 | |
Pipeline Name | edge-inline-replacement-demon | |
Pipeline Version | 7c702eca-8acf-45e0-bdcd-bbb48a5102e5 | |
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/edge-inline-replacement-demon:7c702eca-8acf-45e0-bdcd-bbb48a5102e5 | |
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/edge-inline-replacement-demon | |
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:56b14a042d69a3a59045c4a07a62326dc6cfde1a07ccb22e5d7f831425e414bc | |
Helm Chart Version | 0.0.1-7c702eca-8acf-45e0-bdcd-bbb48a5102e5 | |
Engine Config | {'engine': {'resources': {'limits': {'cpu': 4.0, 'memory': '3Gi'}, 'requests': {'cpu': 4.0, 'memory': '3Gi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}, 'engineAux': {'autoscale': {'type': 'none'}, 'images': None}} | |
User Images | [] | |
Created By | john.hummel@wallaroo.ai | |
Created At | 2024-04-22 15:27:55.628456+00:00 | |
Updated At | 2024-04-22 15:27:55.628456+00:00 | |
Replaces | ||
Docker Run Command |
Note: Please set the PERSISTENT_VOLUME_DIR , 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. |
The following shows two methods of model deployments on edge devices. For more details on model edge deployments using Docker or helm
with Wallaroo, see Model Operations: Run Anywhere.
For the model deployment to the edge location via docker run
, use the Docker Run Command
displayed with the pipeline publish. The following variables must be set first.
PERSISTENT_VOLUME_DIR
: The file path for the persistent volume to store session data.EDGE_PORT
: The external port to connect to, typically 8080
.OCI_USERNAME
: The username for the OCI registry service.OCI_PASSWORD
: The password or token for the OCI registry service.Before deploying the pipeline, verify that Docker is able to connect to the OCI registry with the following command.
docker login -u $OCI_USERNAME --password $OCI_PASSWORD (Your registry URL)
We will perform sample inferences on the current model edge deployment to demonstrate how the inferences change as the models are updated through the in-line edge deployments.
With the model deployed on the edge location, we will perform sample inferences on the edge deployment. For this example, the hostname is testboy.local
. Adjust the hostname to fit your edge location deployment.
The following endpoints are available.
Endpoint | Type | Description |
---|---|---|
/models | GET | Returns the models and model versions used in the edge deployment. |
/pipelines | GET | Returns the pipeline ID and status of the pipeline used in the edge deployment. |
/infer | POST | The inference request endpoint. This accepts either an Apache Arrow table, or a JSON in pandas record format. |
For more details on model edge deployments with Wallaroo, see Model Operations: Run Anywhere.
First we’ll retrieve the model. We should see the same name we set when we uploaded it to the Wallaroo instance.
!curl testboy.local:8080/models
{"models":[{"sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6","name":"rf-house-price-estimator","version":"02f05eac-5b37-4784-84a4-5db7ab95b65b","status":"Running"}]}
Now we’ll retrieve the pipeline details, and verify the name is the same as set earlier and it is running.
!curl testboy.local:8080/pipelines
{"pipelines":[{"id":"edge-inline-replacement-demon","version":"7c702eca-8acf-45e0-bdcd-bbb48a5102e5","status":"Running"}]}
Now do the infer with the same DataFrame we used for our sample inference when the model was deployed in the Wallaroo instance.
We use the endpoint /infer
; this endpoint remains the same even if the models and the pipeline changes, which is demonstrated in the later steps.
import json
df = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]]})
data = df.to_dict(orient="records")
!curl -X POST testboy.local:8080/infer \
-H "Content-Type: Content-Type: application/json; format=pandas-records" \
--data '{json.dumps(data)}' > ./inferenceoutput.df.json
# get the dataframe from what we just did
df_result = pd.read_json('./inferenceoutput.df.json', orient="records")
df_result.loc[:, ['time', 'out', 'metadata']]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 628 100 500 100 128 1811 463 --:--:-- --:--:-- --:--:-- 2283
time | out | metadata | |
---|---|---|---|
0 | 1713800294502 | {'variable': [718013.7]} | {'last_model': '{"model_name":"rf-house-price-estimator","model_sha":"e22a0831aafd9917f3cc87a15ed267797f80e2afa12ad7d8810ca58f173b8cc6"}', 'pipeline_version': '7c702eca-8acf-45e0-bdcd-bbb48a5102e5', 'elapsed': [142461514, 55185536], 'dropped': [], 'partition': 'houseprice-edge-inline-demonstration'} |
Pipeline publishes are replaced with the wallaroo.pipeline.Pipeline.publish()
method. This creates a new publish from the most recent pipeline version and takes the following parameters.
Parameter | Type | Description |
---|---|---|
deployment_config | wallaroo.deployment_config.DeploymentConfig (Optional) | The deployment configuration used for the edge deployment. By default, this is the same deployment configuration used for the pipeline. |
replaces | [List[wallaroo.pipeline_publish]] (Optional) | The pipeline publish(es) to replace. |
When a pipeline published is replaced with a new one, the edge locations are transferred to the pipeline that the publish came from. In this example, this is the same pipeline. Inference results from the edge location deployments are stored with the pipeline that generated the publish. Note that if the model or pipeline steps have changed from one pipeline version to the next, the pipeline log schema will change with it. For more information, see Wallaroo SDK Essentials Guide: Pipeline Log Management.
We verify that the pipeline is published and is assigned edge locations via the wallaroo.pipeline.Pipeline.publishes()
method and wallaroo.pipeline.Pipeline.list_edges()
method.
display('Publishes:')
display(mainpipeline.publishes())
display('Edge Locations')
display(mainpipeline.list_edges())
'Publishes:'
id | pipeline_version_name | engine_url | pipeline_url | created_by | created_at | updated_at |
---|---|---|---|---|---|---|
1 | 7c702eca-8acf-45e0-bdcd-bbb48a5102e5 | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2024.1.0-main-4963 | ghcr.io/wallaroolabs/doc-samples/pipelines/edge-inline-replacement-demon:7c702eca-8acf-45e0-bdcd-bbb48a5102e5 | john.hummel@wallaroo.ai | 2024-22-Apr 15:27:55 | 2024-22-Apr 15:27:55 |
'Edge Locations'
ID | Name | Tags | SPIFFE ID |
---|---|---|---|
e3c7946b-24f9-4c20-b57a-46ad3c1d66e2 | houseprice-edge-inline-demonstration | [] | wallaroo.ai/ns/deployments/edge/e3c7946b-24f9-4c20-b57a-46ad3c1d66e2 |
The following demonstrates replacing a pipeline publish with a new publish from a pipeline version. In this procedure, the edge location has an existing model edge deployment. The publish that is used for that deployment is replaced, and an in-line update of the model deployment is performed on the edge device.
For the next demonstration, we will use the same pipeline and update the pipeline steps with a new model. This time with the model ./models/xgb_model.onnx
, which takes the same input as ./models/rf_model.onnx
. We will also set a different name for this model to distinguish it from the one previously uploaded and used as the pipeline step.
Once set, we will deploy the pipeline with the new model, and perform a new inference request. From this, we will see that this new model outputs a slightly different prediction that the previous one - closer to $650k
.
housing_model_challenger01 = (wl.upload_model("xgb-house-price-estimator",
'./models/xgb_model.onnx',
framework=Framework.ONNX)
.configure(tensor_fields=["tensor"])
)
# undeploy if already created earlier
mainpipeline.undeploy()
# clear the steps if used before
mainpipeline.clear()
mainpipeline.add_model_step(housing_model_challenger01)
name | edge-inline-replacement-demon |
---|---|
created | 2024-04-22 15:27:36.828826+00:00 |
last_updated | 2024-04-22 15:27:54.932609+00:00 |
deployed | False |
arch | x86 |
accel | none |
tags | |
versions | 7c702eca-8acf-45e0-bdcd-bbb48a5102e5, 2ef51c5c-bc58-49b3-9ecf-9aa4bb0a0bae, fbc4bf00-d97f-4be1-a47c-85c788dd90d5 |
steps | rf-house-price-estimator |
published | False |
#minimum deployment config
deploy_config = wallaroo.DeploymentConfigBuilder().replica_count(1).cpus(0.5).memory("1Gi").build()
mainpipeline.deploy(deployment_config = deploy_config)
mainpipeline.steps()
[{'ModelInference': {'models': [{'name': 'xgb-house-price-estimator', 'version': 'a86668be-03ed-47f8-8f49-9e31fe502566', 'sha': '31e92d6ccb27b041a324a7ac22cf95d9d6cc3aa7e8263a229f7c4aec4938657c'}]}}]
normal_input = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]]})
result = mainpipeline.infer(normal_input)
display(result)
time | in.tensor | out.variable | anomaly.count | |
---|---|---|---|---|
0 | 2024-04-22 15:39:30.567 | [4.0, 2.5, 2900.0, 5505.0, 2.0, 0.0, 0.0, 3.0, 8.0, 2900.0, 0.0, 47.6063, -122.02, 2970.0, 5251.0, 12.0, 0.0, 0.0] | [659806.0] | 0 |
From our pipeline, we will publish the new version. The method wallaroo.pipeline.Pipeline.publish()
creates a new publish from the most recent pipeline version and takes the following parameters.
We will replace our publish earlier, labeled pub
, with the new publish generated from the pipeline labeled new_pub
.
The details on deploying the replaced pipeline publish(es) is under the Replaces
section.
new_pub = mainpipeline.publish(replaces=[pub])
new_pub
Waiting for pipeline publish... It may take up to 600 sec.
Pipeline is publishing....... Published.
ID | 2 | ||||
Pipeline Name | edge-inline-replacement-demon | ||||
Pipeline Version | c6a1e945-7de0-4f2c-addb-4f4746114a86 | ||||
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/edge-inline-replacement-demon:c6a1e945-7de0-4f2c-addb-4f4746114a86 | ||||
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/edge-inline-replacement-demon | ||||
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:b5cbf51760fcf319c2c5610346fa9bc55047340509d94091eac36ec2beec9158 | ||||
Helm Chart Version | 0.0.1-c6a1e945-7de0-4f2c-addb-4f4746114a86 | ||||
Engine Config | {'engine': {'resources': {'limits': {'cpu': 4.0, 'memory': '3Gi'}, 'requests': {'cpu': 4.0, 'memory': '3Gi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}, 'engineAux': {'autoscale': {'type': 'none'}, 'images': None}} | ||||
User Images | [] | ||||
Created By | john.hummel@wallaroo.ai | ||||
Created At | 2024-04-22 15:40:51.411106+00:00 | ||||
Updated At | 2024-04-22 15:40:51.411106+00:00 | ||||
Replaces | Publish 1, Pipeline "edge-inline-replacement-demon", Version 3 | ||||
Docker Run Command |
Note: Please set the PERSISTENT_VOLUME_DIR , 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. |
Note that in the Replaces
section, updates are given for each edge location. On the edge device, we deploy the new pipeline publish either by the provided Docker Run Command or Helm Install Command. Note that the Helm Install Command uses helm upgrade
rather than helm install
to create a new revision. The pipeline steps and models will be changed at the model edge location.
Before we do so, we will verify the edge locations associated for our pipelines. mainpipeline
will still have its edges, since we only updated the pipeline version, while new_pipeline
has no edges yet.
We deploy the in-line model update in our new publish above for the edge location, then perform the same checks of the models, pipeline, then a sample inference using the same inference input data as before.
We will see the new model name and model version used.
!curl testboy.local:8080/models
{"models":[{"sha":"31e92d6ccb27b041a324a7ac22cf95d9d6cc3aa7e8263a229f7c4aec4938657c","name":"xgb-house-price-estimator","version":"a86668be-03ed-47f8-8f49-9e31fe502566","status":"Running"}]}
!curl testboy.local:8080/pipelines
{"pipelines":[{"id":"edge-inline-replacement-demon","version":"c6a1e945-7de0-4f2c-addb-4f4746114a86","status":"Running"}]}
We now perform the same inference request on the edge location deployment, and show the results match that as the pipeline with the new model.
import json
df = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]]})
data = df.to_dict(orient="records")
!curl -X POST testboy.local:8080/infer \
-H "Content-Type: Content-Type: application/json; format=pandas-records" \
--data '{json.dumps(data)}' > inferenceoutput.df.json
# get the dataframe from what we just did
df_result = pd.read_json('./inferenceoutput.df.json', orient="records")
df_result.loc[:, ['time', 'out', 'metadata']]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 624 100 496 100 128 30468 7862 --:--:-- --:--:-- --:--:-- 39000
time | out | metadata | |
---|---|---|---|
0 | 1713800558148 | {'variable': [659806.0]} | {'last_model': '{"model_name":"xgb-house-price-estimator","model_sha":"31e92d6ccb27b041a324a7ac22cf95d9d6cc3aa7e8263a229f7c4aec4938657c"}', 'pipeline_version': 'c6a1e945-7de0-4f2c-addb-4f4746114a86', 'elapsed': [359571, 613994], 'dropped': [], 'partition': 'houseprice-edge-inline-demonstration'} |
For this example, we will create a separate pipeline than the previous one with its own model. This model will still accept the same inputs and output fields as the models previously deployed. This is not a requirement - completely different models with different inputs and output schemas can be used; this example is used for simplicity.
For this set of examples, we will upload the third model, ./models/gbr_model.onnx
and create a new pipeline named new-edge-inline-replacement
. This model is added as a pipeline step and deployed.
housing_model_challenger02 = (wl.upload_model("gbr-house-price-estimator",
'./models/gbr_model.onnx',
framework=Framework.ONNX)
.configure(tensor_fields=["tensor"])
)
new_pipeline = wl.build_pipeline("new-edge-inline-replacement")
# undeploy if used before
new_pipeline.undeploy()
# clear the steps if used before
new_pipeline.clear()
new_pipeline.add_model_step(housing_model_challenger02)
#minimum deployment config
deploy_config = wallaroo.DeploymentConfigBuilder().replica_count(1).cpus(0.5).memory("1Gi").build()
new_pipeline.deploy(deployment_config = deploy_config)
new_pipeline.steps()
[{'ModelInference': {'models': [{'name': 'gbr-house-price-estimator', 'version': '18b322c6-7681-44c5-a607-d8ec1f021651', 'sha': 'ed6065a79d841f7e96307bb20d5ef22840f15da0b587efb51425c7ad60589d6a'}]}}]
normal_input = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]]})
result = new_pipeline.infer(normal_input)
display(result)
time | in.tensor | out.variable | anomaly.count | |
---|---|---|---|---|
0 | 2024-04-22 15:43:20.716 | [4.0, 2.5, 2900.0, 5505.0, 2.0, 0.0, 0.0, 3.0, 8.0, 2900.0, 0.0, 47.6063, -122.02, 2970.0, 5251.0, 12.0, 0.0, 0.0] | [704901.9] | 0 |
We will now publish the new pipeline, and replace the previous edge location publish from our original pipeline. The last publish is labeled new_pub
is labeled new_pipeline_pub
.
new_pipeline_pub = new_pipeline.publish(replaces=[new_pub])
new_pipeline_pub
Waiting for pipeline publish... It may take up to 600 sec.
Pipeline is publishing....... Published.
ID | 3 | ||||
Pipeline Name | new-edge-inline-replacement | ||||
Pipeline Version | 455a7840-08c3-43bb-b6a6-7535894e6055 | ||||
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/new-edge-inline-replacement:455a7840-08c3-43bb-b6a6-7535894e6055 | ||||
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/new-edge-inline-replacement | ||||
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:e6d53f03950ffeb7ecf623a5ac43f6d5d65a4edf935b43d1b038f629bf9c0a0b | ||||
Helm Chart Version | 0.0.1-455a7840-08c3-43bb-b6a6-7535894e6055 | ||||
Engine Config | {'engine': {'resources': {'limits': {'cpu': 4.0, 'memory': '3Gi'}, 'requests': {'cpu': 4.0, 'memory': '3Gi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}, 'engineAux': {'autoscale': {'type': 'none'}, 'images': None}} | ||||
User Images | [] | ||||
Created By | john.hummel@wallaroo.ai | ||||
Created At | 2024-04-22 15:44:47.149059+00:00 | ||||
Updated At | 2024-04-22 15:44:47.149059+00:00 | ||||
Replaces | Publish 2, Pipeline "edge-inline-replacement-demon", Version 5 | ||||
Docker Run Command |
Note: Please set the PERSISTENT_VOLUME_DIR , 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. |
Once complete, we update the edge deployment with the new replacement docker run
or helm
based deployment commands from the configuration.
With the edge location replacement complete with the new pipeline, we list the edge locations from the original pipeline and the new one to show the edge location is transferred to the new pipeline.
display(mainpipeline.list_edges())
(no pipelines)
display(new_pipeline.list_edges())
ID | Name | Tags | SPIFFE ID |
---|---|---|---|
e3c7946b-24f9-4c20-b57a-46ad3c1d66e2 | houseprice-edge-inline-demonstration | [] | wallaroo.ai/ns/deployments/edge/e3c7946b-24f9-4c20-b57a-46ad3c1d66e2 |
We deploy the new publish on the edge device either with the Docker Run Command or the Helm Install Command, with whatever modifications are required on the edge device. Once complete, we run through the /models
and /pipelines
endpoints, then perform an inference request. We will see the name of the new model - and the new pipeline used for the same edge location.
!curl testboy.local:8080/models
{"models":[{"sha":"ed6065a79d841f7e96307bb20d5ef22840f15da0b587efb51425c7ad60589d6a","name":"gbr-house-price-estimator","version":"18b322c6-7681-44c5-a607-d8ec1f021651","status":"Running"}]}
!curl testboy.local:8080/pipelines
{"pipelines":[{"id":"new-edge-inline-replacement","version":"455a7840-08c3-43bb-b6a6-7535894e6055","status":"Running"}]}
# new inference
import json
df = pd.DataFrame.from_records({"tensor": [[4.0,
2.5,
2900.0,
5505.0,
2.0,
0.0,
0.0,
3.0,
8.0,
2900.0,
0.0,
47.6063,
-122.02,
2970.0,
5251.0,
12.0,
0.0,
0.0]
]
})
data = df.to_dict(orient="records")
!curl -X POST testboy.local:8080/infer \
-H "Content-Type: Content-Type: application/json; format=pandas-records" \
--data '{json.dumps(data)}' > inferenceoutput.df.json
# get the dataframe from what we just did
df_result = pd.read_json('./inferenceoutput.df.json', orient="records")
df_result.loc[:, ['time', 'out', 'metadata']]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 624 100 496 100 128 25180 6498 --:--:-- --:--:-- --:--:-- 32842
time | out | metadata | |
---|---|---|---|
0 | 1713800828863 | {'variable': [704901.9]} | {'last_model': '{"model_name":"gbr-house-price-estimator","model_sha":"ed6065a79d841f7e96307bb20d5ef22840f15da0b587efb51425c7ad60589d6a"}', 'pipeline_version': '455a7840-08c3-43bb-b6a6-7535894e6055', 'elapsed': [337802, 597249], 'dropped': [], 'partition': 'houseprice-edge-inline-demonstration'} |
With the tutorial complete, we undeploy the pipelines and return the resources back to the cluster.
mainpipeline.undeploy()
new_pipeline.undeploy()
name | new-edge-inline-replacement |
---|---|
created | 2024-04-22 15:43:04.574641+00:00 |
last_updated | 2024-04-22 15:44:46.403831+00:00 |
deployed | False |
arch | x86 |
accel | none |
tags | |
versions | 455a7840-08c3-43bb-b6a6-7535894e6055, 5210e01e-6d0f-4cdc-92ea-d3499bcc42fc, d61fcf2d-95ad-41e7-9e53-50610d9e0419 |
steps | gbr-house-price-estimator |
published | False |