Obtaining Service Details

Function

This API is used to obtain the details about a model service based on the service ID.

Debugging

You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.

URI

GET /v1/{project_id}/services/{service_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

service_id

Yes

String

Service ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

service_id

String

Service ID

service_name

String

Service name

description

String

Service description

tenant

String

Tenant to which a service belongs

project

String

Project to which a service belongs

owner

String

User to which a service belongs

publish_at

Number

Latest service release time, in milliseconds calculated from 1970.1.1 0:0:0 UTC

infer_type

String

Inference mode. Options:

  • real-time

  • batch

workspace_id

String

Workspace ID

cluster_id

String

ID of the dedicated resource pool used by the real-time or batch service. This parameter is available only when a dedicated resource pool is used.

vpc_id

String

ID of the VPC to which the real-time service instance belongs. This parameter is available when the network configuration is customized.

subnet_network_id

String

ID of the subnet to which the real-time service instance belongs. This parameter is available when the network configuration is customized.

security_group_id

String

Security group to which the real-time service instance belongs. This parameter is available when the network configuration is customized.

status

String

Service status. Options:

  • running: The service is running properly.

  • deploying: The service is being deployed, including image creation and resource scheduling deployment.

  • concerning: An alarm has been generated, indicating that some backend instances malfunction.

  • failed: Deploying the service failed. For details about the failure cause, see the event and log tab pages.

  • stopped: The service has been stopped.

  • finished: Service running is completed. This status is available only for batch services.

progress

Integer

Deployment progress. This parameter is available when the status is deploying.

error_msg

String

Error message. When status is failed, an error message carrying the failure cause is returned.

config

Array of QueryServiceConfig objects

Service configuration (If a service is shared, only model_id, model_name, and model_version are returned.)

access_address

String

Access address of an inference request. This parameter is available when infer_type is set to real-time.

bind_access_address

String

Request address of a custom domain name. This parameter is available after a domain name is bound.

invocation_times

Number

Total number of service calls

failed_times

Number

Number of failed service calls

is_shared

Boolean

Whether a service is subscribed

shared_count

Number

Number of subscribed services

schedule

Array of Schedule objects

Service scheduling configuration. If this parameter is not configured, no value will be returned.

update_time

Number

Time when the configuration used by a service is updated, in milliseconds calculated from 1970.1.1 0:0:0 UTC

debug_url

String

Online debugging address of a real-time service. This parameter is available only when the model supports online debugging and there is only one instance.

due_time

Number

Time when a real-time service automatically stops, in milliseconds calculated from 1970.1.1 0:0:0 UTC. If auto stop is not enabled, no value will be returned.

operation_time

Number

Operation time of a request

transition_at

Number

Time when the service status changes

is_free

Boolean

Whether a free-of-charge flavor is used

additional_properties

Map<String,String>

Additional service attribute

pool_name

String

Specifies the ID of the new dedicated resource pool. By default, this parameter is left blank, indicating that the dedicated resource pool is not used. This parameter corresponds to the ID of the new resource pool.

Table 4 QueryServiceConfig

Parameter

Type

Description

model_version

String

Model version

finished_time

Number

Task finished time, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is not returned until the task ends.

custom_spec

CustomSpec object

Custom resource specifications

envs

Map<String,String>

Environment variable key-value pair required for running a model

specification

String

Resource flavor, which can be modelarts.vm.cpu.2u, modelarts.vm.gpu.p4, or modelarts.vm.ai1.a310/custom

weight

Integer

Traffic weight allocated to a model

source_type

String

Model source. This parameter is returned when a model is created using ExeML. The value is auto.

model_id

String

Model ID

src_path

String

OBS path to the input data of a batch job

req_uri

String

Inference path of a batch job

mapping_type

String

Mapping type of the input data, which can be file or csv

start_time

Number

Task start time, in milliseconds calculated from 1970.1.1 0:0:0 UTC. This parameter is not returned until the task starts.

cluster_id

String

ID of a dedicated resource pool used by a service instance. This parameter is returned only when a dedicated resource pool is configured.

nodes

Array of Nodes objects

Node information

mapping_rule

Object

Mapping between input parameters and CSV data. This parameter is mandatory only when mapping_type is set to csv.

model_name

String

Model name

src_type

String

Data source type. This parameter is returned only when ManifestFile is used.

dest_path

String

OBS path to the output data of a batch job

instance_count

Integer

Number of instances deployed for a model

status

String

Service status. Options:

  • running: The service is running properly.

  • deploying: The service is being deployed, including image creation and resource scheduling deployment.

  • concerning: An alarm has been generated, indicating that some backend instances malfunction.

  • failed: Deploying the service failed. For details about the failure cause, see the event and log tab pages.

  • stopped: The service has been stopped.

  • finished: Service running is completed. This status is available only for batch services.

scaling

Boolean

Whether auto scaling is enabled

support_debug

Boolean

Whether a model supports online debugging

additional_properties

Map<String,String>

Additional model deployment attribute

pool_name

String

Specifies the ID of the new dedicated resource pool. By default, this parameter is left blank, indicating that the dedicated resource pool is not used. This parameter corresponds to the ID of the new resource pool.

Table 5 CustomSpec

Parameter

Type

Description

gpu_p4

Float

(Optional) Number of GPU cores, which can be a decimal. The value cannot be smaller than 0, which allows up to two decimal places.

memory

Integer

Memory in MB, which must be an integer

cpu

Float

Number of CPU cores, which can be a decimal. The value cannot be smaller than 0.01.

ascend_a310

Integer

Number of Ascend chips. This parameter is optional and is not used by default. Either this parameter or gpu_p4 is configured.

Table 6 Nodes

Parameter

Type

Description

memory

Integer

Memory size, in MB

os_version

String

OS version of a node

cpu

Integer

Number of CPU cores

created_at

String

Creation time, in the format of YYYY-MM-DDThh:mm:ss (UTC)

description

String

Description

message

String

Cause if instance_status is failed or notReady

predict_url

String

Inference URL of a node

enable_gpu

Boolean

Whether to enable GPUs

gpu_num

Integer

Number of GPUs

host_ips

Array of strings

Host IP address of a node

updated_at

String

Update time, in the format of YYYY-MM-DDThh:mm:ss (UTC)

node_label

String

Node label

os_type

String

OS type of a node

name

String

Name of an edge node

os_name

String

OS name of a node

arch

String

Node architecture

id

String

Edge node ID

instance_status

String

Status of a model instance on a node, which can be running, stopped, notReady, or failed

state

String

Host status, which can be RUNNING, FAIL, or UNCONNECTED

deployment_num

Integer

Number of application instances deployed on a node

host_name

String

Host name of a node

Table 7 Schedule

Parameter

Type

Description

duration

Integer

Value mapping a time unit. For example, if the task stops after two hours, set time_unit to HOURS and duration to 2.

time_unit

String

Scheduling time unit. Possible values are DAYS, HOURS, and MINUTES.

type

String

Scheduling type. Only the value stop is supported.

Example Requests

GET https://{endpoint}/v1/{project_id}/services/{service_id}

Example Responses

Status code: 200

Service Details

{
  "service_id" : "f76f20ba-78f5-44e8-893a-37c8c600c02f",
  "service_name" : "service-demo",
  "tenant" : "xxxxx",
  "project" : "xxxxx",
  "owner" : "xxxxx",
  "publish_at" : 1585809231902,
  "update_time" : 1585809358259,
  "infer_type" : "real-time",
  "status" : "running",
  "progress" : 100,
  "access_address" : "https://xxxxx.apigw.xxxxx.com/v1/infers/088458d9-5755-4110-97d8-1d21065ea10b/f76f20ba-78f5-44e8-893a-37c8c600c02f",
  "cluster_id" : "088458d9-5755-4110-97d8-1d21065ea10b",
  "workspace_id" : "0",
  "additional_properties" : { },
  "is_shared" : false,
  "invocation_times" : 0,
  "failed_times" : 0,
  "shared_count" : 0,
  "operation_time" : 1586249085447,
  "config" : [ {
    "model_id" : "044ebf3d-8bf4-48df-bf40-bad0e664c1e2",
    "model_name" : "jar-model",
    "model_version" : "1.0.1",
    "specification" : "custom",
    "custom_spec" : { },
    "status" : "notReady",
    "weight" : 100,
    "instance_count" : 1,
    "scaling" : false,
    "envs" : { },
    "additional_properties" : { },
    "support_debug" : false
  } ],
  "transition_at" : 1585809231902,
  "is_free" : false
}

Status Codes

Status Code

Description

200

Service Details

Error Codes

See Error Codes.