创建一个部署file

A deployment file defines web services that are exposed by the Scoring Agent to score data. Following section describes step by step how to create and obtain a Scoring Agent deployment file from RapidMiner Server.

创建一个部署on RapidMiner Server

To create a deployment file for the Scoring Agent create a new folder in the RapidMiner Server repository. The folder can be placed anywhere and will be used to define the contents of the deployment. Keep in mind that everything stored in this folder will be included in the deployment file. This includes processes as well as data and models. Top-level processes of the deployment folder will be exposed as web services.

The image below shows an example deployment folder calledscore-fraud:

It contains two top-level processes calledScore-v1Score-v2和一个data/folder. Thedata/folder contains the production modelsmodel-v1model-v2that are used by the top-level processes for scoring and a training processTrain Modelswhich builds the models.

一般来说得分代理公开顶级职业cesses of a scoring folder based on following schema:

http://$SA_HOST/services/$folderName/$processName

Therefore the base path of the deployment will be the same as the folder name and the endpoint paths of the two top-level processes will be the same as the process names. Let's assume the Scoring Agent is running onlocalhostwith default settings. The full URL of the web services exposed by thescore-frauddeployment will look like this:

  • http://localhost:8090/services/score-fraud/score-v1
  • http://localhost:8090/services/score-fraud/score-v2

The processTrain Modelswill not be available as a web service as it is not a top-level process.

Please note that special characters in the name of the deployment folder and top-level processes will be URL encoded. A process calledscore customerstored in the foldercustomer churn/will be available as a web service athttp://$SA_HOST/services/customer%20churn/score%20customer.

Create a scoring process

Each web service offered by the Scoring Agent relies on a RapidMiner Studio process. Here's an example of a simple scoring process:

The process will load a previously trained model from the repository and apply it on the input data. Afterwards the scoring results will be delivered to an output port.

TheRetrieveoperator works only with relative paths and only with data that is contained in the deployment folder or its subfolders.

For easier local testing of a scoring process you can assign input data to the input port via the process context. Or just drag&drop data on the input port.

Download deployment file from RapidMiner Server

The deployment file can now be downloaded from RapidMiner Server either via command line or via browser. Both possibilities are described below.

Downloading the deployment from RapidMiner Server will create a .zip file with a snapshot of the current deployment folder content together with a configuration file that defines the endpoints of deployment.

Download via command line

To trigger the deployment creation via command line you can, for example, usecurlor any other tool which fits the needs. The creation URL is defined ashttp://$RM_SERVER/api/rest/resources/$LOCATION?format=webservice. Where

  • $RM_SERVERis the host name of the RapidMiner Server (e.g.localhost:8080)
  • $LOCATIONis the repository location of the deployment folder (e.g.deployments/score-fraud)

So, in our case the URL looks like this:

http://localhost:8080/api/rest/resources/deployments/score-fraud?format=webservice

和一个n examplecurlcommand looks like this:

curl -u user:password 'http://localhost:8080/api/rest/resources/deployments/score-fraud?format=webservice' -o deployment.zip

It's also possible to include one or more connections from the central repository into thedeployment.zipfile by referencing the name of it. Assume a connection is calledMyDB和it resides in the default location/Connections/MyDBof the repository, then adding a query parameter with&connection=MyDBwill include the connection into the created deployment file.

So, in our case the URL might look like this if we like to include connectionsMyDBMySecondDBat the same time:

http://localhost:8080/api/rest/resources/deployments/score-fraud?format=webservice&connection=MyDB&connection=MySecondDB

Connections having injected parameters are not supported within the Scoring Agent. Please ensure that you didn’t define any injected parameters for the connections you like to include into your deployment ZIP file.

Download via browser

To trigger the deployment creation via browser you just need to visit the resource URL of your created deployment folder. The URL is defined ashttp://$RM_SERVER/internal/rest/resources/$LOCATION?format=webservice. Where

  • $RM_SERVERis the host name of the RapidMiner Server (e.g.localhost:8080)
  • $LOCATIONis the repository location of the deployment folder (e.g.deployments/score-fraud)

So, in our case the browser URL looks like this:

http://localhost:8080/internal/rest/resources/deployments/score-fraud?format=webservice

What's next?

After you have downloaded the deployment file you caninstall it on a Scoring Agent.