Categories

Versions

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:

  1. 下载一个部署ZIP from RapidMiner AI Hub,
  2. upload the ZIP to the external endpoint infrastructure,
  3. place the ZIP in thedeploymentsfolder, and
  4. 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 thebasePathin the fileconfig.jsonin the deployment ZIP, and
  • as the$deployment_pathin 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 aPOSTrequest via command line, e.g., with the旋度command to the followingURL:

[POST] https://$RM_SERVER/api/v1/repositories/$PROJECT_ID/deployment/$REF

where

  • $RM_SERVERis the host name of the RapidMiner Server (e.g.localhost:8080)
  • $PROJECT_IDis the lower case ID of your project (e.g.sample-dev)
  • $REFis the reference exposed by the underlying Git (projects rely on Git under the hood), most likely it'smaster

ThePOSTrequest'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 namedexample-deployment, so Scoring Agents will serve endpoints under/api/v1/services/example-deployment/
  • TheprocessLocationsdefines 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
  • TheadditionalLocationsproperty 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
  • continuousis an optional flag to allow continuous re-execution while a deployment is enabled on the Scoring Agent
  • sleepis an optional number how long the Scoring Agent will wait before re-executing a deployment, only applies whencontinuousis enabled

To invoke deployment creation, you need a valid Bearer token. In addition, the token needs to have theadminrole or theaihub:projects:deployment-creationrole. When including connections theaihub:deployment-creation-connectionsis 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 parametercontinuoustotrue. You can also define a delay in milliseconds between each execution by adding the request body's propertiessleep=5000which would delay each execution by 5000 milliseconds. If you omit the sleep parameter a default of1milliseconds will be used but only ifcontinuous modeis enabled.