Deploy the PAI-Rec service to EAS
This topic describes how to deploy the PAI-Rec service to Elastic Algorithm Service (EAS).
The following shows that a recommendation solution is deployed in the PAI-Rec console.
In the left-side navigation pane, choose Customized Recommendation Solution > Deployment History. Set the Deployment Status filter to Successful, and confirm that your recommendation solution is listed with a Successful status.
After the PAI-Rec service is deployed, you can deploy it to EAS.
1. Engine Configurations
In the left-side navigation pane of the PAI-REC console, click Engine Configuration under System Configuration. From the Current Development Environment drop-down list, select the target environment, such as Daily. A list of existing configurations is displayed, with columns such as sequence number, configuration name, and update time. Click Create Configuration.
Before you create configurations for the PAI-Rec engine, you must prepare a data source. After you create a configuration for the PAI-Rec engine, you need to release the configuration. Configure the PAI-Rec engine based on your business requirements. For more information, see Engine configuration.
Note:
In different development environments, you must specify different values for the RunMode parameter.
● daily: the daily environment.
● prepub: the staging environment.
● product: the production environment.
The following shows the sample configurations for a daily runtime environment.
{
"RunMode": "daily",
"ListenConf": {
"HttpAddr": "",
"HttpPort": 8000
},
"ABTestConf": {
"Host": "",
"Token": ""
},
"FilterConfs": [],
"RecallConfs": [
{
"Name": "user2item_recall",
"RecallType": "UserCustomRecall",
"RecallCount": 500,
"DaoConf": {
"AdapterType": "hologres",
"HologresName": "xxx",
"HologresTableName": "uti_demo"
}
}
]
}
2. Service Management
In the left-side navigation pane, expand System Configuration and click Service Management. The page has a Create Service button. The service list displays the name of each service and its Staging Environment Status, such as Running or Not Deployed.
Use Service Management with PAI-EAS to deploy the engine service to EAS. You need to deploy the engine service for both the staging and production environments. The deployment procedure is the same for both environments.
1. Basic Configurations
On the Basic Configurations page, enter a Service Name (which must be consistent with the service name in PAI-EAS) and a Service Description. Select a Region, such as China (Hangzhou), and an Image Name (official or custom). The selected image must correspond to the specified region. Set the Image Version, such as 2.0.0, enter the Image Secret, and select a Recommended Engine Configuration that matches your engine configuration.
2. EAS Configurations
In the EAS Resource Group section, select public resource group. The EAS Configuration File area contains the Staging Environment Configuration and Production Environment Configuration tabs. During deployment, replace the AccessKey, AccessKey Secret, and image version in the configuration with your actual values. You need to prepare two PAI-EAS instances. The service name for the staging environment must have a_staging suffix.
Follow the console wizard to complete the basic and EAS configurations. Copy the configuration information and navigate to the PAI-EAS console. In the PAI-EAS console, click Deploy Service and select Custom Deployment to open the configuration page.
Paste the EAS configuration that you copied from the PAI-REC console into the configuration editor, and then complete the Virtual Private Cloud (VPC) settings.
In the VPC Settings section, select a VPC, vSwitch, and security group. If you do not have these resources, you can create them by using the links on the right.
The configuration page has a JSON editor on the left and resource settings, such as for the VPC, on the right.
Click Deploy. After a success message is displayed, the service is deployed to EAS.
If an error occurs, see EAS FAQ.
3. Release to Staging Environment and Release to Production Environment
On the staging publish page, set Publish to Staging Environment to Publish Now. Enter a Publish Title and Publish Content. In the Image Version section, select Get from API, choose the corresponding version, and then click Publish.
The processes of releasing a service in the staging and production environments are similar.
After PAI-REC validates and publishes the service, return to the Service Management page to view its details.
The publication is successful if the status for both the staging and production environments is displayed as Running.