Deploying an Algorithm Model

This topic describes the detailed steps for deploying an algorithm model.

Before you start

Before deploying an algorithm model, you need to complete the following tasks:

  1. Upload the model source files to the GitLab project

  2. Register the GitLab data source through Data Source Registration and complete the connection test

Creating a deployment

Take the following steps to create a deployment for the algorithm model:

  1. Log in to EnOS Management Console, select ML Model Hosting from the left navigation bar, and click New Deployment.

  2. In the Basic Information section, type the deployment name and description.

  3. In the Files for Model and Deployment section, click the Add File button, select the registered GitLab data source, and type the file path in GitLab project.

    ../_images/git_path.png

    Note

    The format of the file path is: {branch}/{directory}/{filename} or {tag}/{directory}/{filename}, for example, master/demo.py.

  4. Click OK to add the selected file, and the added file will be displayed in the file list. Repeat the steps above to add more files.

    Note

    The size of a single file must not exceed 2MB, and the number of files must not exceed 10. When updating a file, delete the file with the same name in the file list, and then add the file again.

  5. In the Model Deployment section, select the file for the main function, type the main function name, and select the running environment for the model deployment. For the specification of the main function, you can refer to the following example:

    def handle(event):
        response = "path: " + event.path + "\n" \
            +"method: " + event.method + "\n" \
            +'args:' + event.args.get('id') + "\n" \
            +'header:' + event.headers.get('User-Agent') + "\n" \
            +'body:' + str(event.body, encoding="utf-8")
    
        return {
            "statusCode": 200,
            "body": response
        }
    
  6. Click OK to save the deployment configuration. See the following example:

    ../_images/sample_deployment.png

Next step

After configuring the algorithm model deployment, you need to start the deployment manually. For more information, see Starting and Manging the Deployment.