Updating Services

Function

This API is used to update inference services.

URI

PUT /v1/{project_id}/infer-services

Table 1 describes the URI parameters.

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

service_name

Yes

String

Service name. The value can contain a maximum of 48 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed. It must start with res- and cannot end with a hyphen.

service_type

Yes

String

Service type. The options are infer, rank, or nlp.

description

No

String

Description for a service.

flows

Yes

List

List of flows. For details, see Table 3.

Table 3 flows parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Flow name. The value can contain a maximum of 60 characters. Only digits, letters, underscores (_), hyphens (-), and spaces are allowed.

rules

Yes

List

Configuration of different traffic and candidate set rules for each flow. For details, see Table 4.

config

Yes

Object

Flow configuration details. For details, see Table 5.

rank_uuid

No

String

UUID generated by using the ranking strategy

feature_uuid

No

String

UUID generated by the offline processing tasks of preprocessing

filter_uuid

No

String

UUID generated by using filter rules

Table 4 rules parameters

Parameter

Mandatory

Type

Description

candidate_id

Yes

String

Candidate set ID

rule_ratio

Yes

Integer

Proportion of data with the same priority. The value is an integer ranging from 0 to 100. The proportion of data with the same level is 100.

priority

Yes

String

Priority. The value is an integer ranging from 1 to 10. The value 1 indicates the highest priority. The value can contain a maximum of 32 characters.

Table 5 config parameters

Parameter

Mandatory

Type

Description

model_id

Yes

String

Model ID

weight

Yes

Integer

A/B test traffic percentage. The value is an integer ranging from 0 to 100. The sum of all flows is 100.

specification

Yes

String

Node specification. Currently, only c2.m8.g0 is supported.

instance_count

Yes

Integer

Number of node instances. A maximum of two instances are supported.

Response

Table 6 describes the response parameters.

Table 6 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Whether the request is successful

service_id

Yes

String

ID of the returned service

Example

  • Example request
    { 
    "service_name": "res-001", 
    "description": " test cusom image", 
    "service_type": "infer",
    "flows":  
    [ 
    { 
    "feature_uuid": "3e749db6b0974f7f8c383af2c39ecb36", 
    "filter_uuid": "94542021b5014451aae49b09df63783b", 
    "rank_uuid": "17c5b4b89baf4260b5afe90d63115de1", 
    "name": "test1", 
    "rules": [ 
    { 
    "candidate_id": "873da1b6486e450d92e46b944f0526af", 
    "rule_ratio": 50, 
    "priority": "1" 
    }, 
    { 
    "candidate_id": "b54e2c23c9294a48bbac2b520ce1a13b", 
    "rule_ratio": 50, 
    "priority": "1" 
    } 
    ] ,
    "config":{
    "model_id": "51f9f632-ee08-4479-a070-252a4f605023",
    "weight": 100,
    "specification": "c2.m8.g0",
    "instance_count": 1
    }
    }
    ] 
    }
  • Example of a successful response
    { 
        "is_success": true, 
        "service_id": "70af84f6-98a8-47aa-aa70-a2a9b4366f7d", 
        }
  • Example of a failed response
    { 
        "is_success": false, 
        "error_code": "res.1001", 
        "error_msg": "The value of request parameter(service_name) is invalid." 
    }

Status Code

For details about status codes, see Status Codes.