Create a deployment ZIP
This document describes how to create an endpoint that is independent of RapidMiner AI Hub, for example on an edge device. SeeInstall the endpoint infrastructure.
If your endpoint is meant to live on RapidMiner AI Hub, return toCreate an endpointand selectthis AI Hub, where you will find a simpler workflow.
As discussed previously inCreate a process, our purpose is to run the processScoreIrisData
, submitting our input data via the endpoint URL and obtaining the result of the process as output. To do so, we need to create an endpoint, in this case an endpoint that lives outside of RapidMiner AI Hub.
To create or update this endpoint, we need to take four steps:
- 下载一个部署ZIP from RapidMiner AI Hub,
- upload the ZIP to the external endpoint infrastructure,
- place the ZIP in thedeploymentsfolder, and
- restart the scoring agent.
This document will cover step 1. A programmatic solution,Use an API to create a deployment ZIP, is given below.
For steps 2., 3., and 4., consult the relevant documentation for your endpoint infrastructure:
Once your deployment ZIP is in place, and the scoring agent has been started / restarted, you are ready to request results!
other device
configure and then download a package to deploy elsewhere
Continuing where we left off (Where do you need an endpoint?), we selectother device.
The resulting dialog
- asks for theBase nameof your deployment,
- reminds you thatconnections不能包含injected parameters, because your endpoint will have no further connection to RapidMiner AI Hub, and
- offers the option of running incontinuous mode, meaning that the endpoint process will run either continuously or at regular intervals, without any need for an external trigger.
For ourBase name, we chooseiris
. That name will reappear
- in the name of the deployment ZIP, together with the project name,
- as the
basePath
in the fileconfig.jsonin the deployment ZIP, and - as the
$deployment_path
in theendpoint URL.
ClickCreateto create the deployment ZIP, and place the resulting ZIP file in thedeploymentsfolder belonging to your endpoint infrastructure. In case of doubt, see the links given in the introduction to this document.
Next:Request results
Use an API to create a deployment ZIP
The API for creating deployment ZIP files has changed from 10.1. to 10.2 to enable the inclusion of arbitrary files within a deployment on other/edge devices.
To trigger deployment creation for an edge device, invoke aPOST
request via command line, e.g., with the旋度
command to the followingURL:
[POST] https://$RM_SERVER/api/v1/repositories/$PROJECT_ID/deployment/$REF
where
$RM_SERVER
is the host name of the RapidMiner Server (e.g.localhost:8080
)$PROJECT_ID
is the lower case ID of your project (e.g.sample-dev
)$REF
is the reference exposed by the underlying Git (projects rely on Git under the hood), most likely it'smaster
ThePOST
request's body defines the deployment name, processes of that Project to expose as endpoint and additional files which will be put into the ZIP file as dependencies.
Here's an example of such a request body which creates a deployment ZIP for edge devices from a given Project:
{ "deploymentName": "example-deployment", "processLocations": [ { "path": "myprocess", "processLocation": "processes/myprocess.rmp", "contextParameters": { "macro1": "macro1" } }, { "path": "anotherprocess", "processLocation": "processes/myprocess2.rmp" } ], "additionalLocations": [ "Connections/test-connection.conninfo", "data/My Data.rmhdf5table" ], "continuous": false, "sleep": 1 }
- The deployment will be named
example-deployment
, so Scoring Agents will serve endpoints under/api/v1/services/example-deployment/
- The
processLocations
defines the exposed endpoints- aliasis the name of the exposed endpoint, in the example the following endpoints would be available:
/api/v1/services/example-deployment/myprocess
/api/v1/services/example-deployment/anotherprocess
- processLocationis the actual location of the process within the Project,aliasdoesn't need to match the name of the location itself
- contextParametersis the optional mapping of input macros transposed to query parameters when defined within the selected RapidMiner process, it can be used to change given macro values by the caller of the endpoint
- Example for aliasmyprocess:
/api/v1/services/example-deployment/myprocess?macro1=
- If the process has no default value for a macro exposed as query parameter, execution will likely fail if the macro is used within the underlying RapidMiner process
- Example for aliasmyprocess:
- aliasis the name of the exposed endpoint, in the example the following endpoints would be available:
- The
additionalLocations
property defines any additional data that can be put into the deployment ZIP such as Connections (make sure to not use Connections with injected parameters) or data sets the RapidMiner processes need continuous
is an optional flag to allow continuous re-execution while a deployment is enabled on the Scoring Agentsleep
is an optional number how long the Scoring Agent will wait before re-executing a deployment, only applies whencontinuous
is enabled
To invoke deployment creation, you need a valid Bearer token. In addition, the token needs to have theadmin
role or theaihub:projects:deployment-creation
role. When including connections theaihub:deployment-creation-connections
is required in addition when the requesting token has no admin claim.
The actual旋度
command of the example would be the following saving the created ZIP file on your disk as file `deployment.zip:
旋度"https://$RM_SERVER/api/v1/repositories/$PROJECT_ID/deployment/$REF" \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ -X POST \ --data '{ "deploymentName": "example-deployment", "processLocations": [ { "path": "myprocess", "processLocation": "processes/myprocess.rmp", "contextParameters": { "macro1": "macro1" } }, { "path": "anotherprocess", "processLocation": "processes/myprocess2.rmp" } ], "additionalLocations": [ "Connections/test-connection.conninfo", "data/My Data.rmhdf5table" ], "continuous": false, "sleep": 1 }' \ -o deployment.zip
If any resource like a process, a data set or a Connection does not exist at the requested location within the Project, the API will return a bad request status code (400
).
The Scoring Agent does not support connections withinjected parameters. If you include a connection in your deployment ZIP, make sure it does not define any injected parameters.
Enable 'continuous mode' for deployment
您可以启用期间连续模式load of a deployment by changing the request body's parametercontinuous
totrue
. You can also define a delay in milliseconds between each execution by adding the request body's propertiessleep=5000
which would delay each execution by 5000 milliseconds. If you omit the sleep parameter a default of1
milliseconds will be used but only ifcontinuous modeis enabled.