ListInstances - 查询实例列表

更新时间: 2023-05-06 10:39:46

查询DSW实例列表。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

GET /api/v2/instances

请求参数

名称类型必填描述示例值
WorkspaceIdstring

按工作空间ID过滤。如何获取工作空间ID,请参见ListWorkspaces

40823
InstanceNamestring

按实例名称过滤。

training_data
ResourceIdstring

按资源组ID过滤。

rg-123456789
Statusstring

根据实例状态过滤,取值如下:

  • Creating:创建中。
  • Running:运行中。
  • Stopped:已停止。
  • Failed:已失败。
Running
PaymentTypestring

付费类型,取值如下:

  • PayAsYouGo:后付费(后付费/按量付费)。
  • Subscription:预付费(预付费/包年包月)。
PayAsYouGo
Accessibilitystring

工作空间可见度。取值如下:

  • PRIVATE(默认值):表示工作空间内自己以及管理员可见。
  • PUBLIC:为工作空间所有用户可见。
PRIVATE
AcceleratorTypestring

加速器类型。 CPU:无计算加速,只使用CPU计算。 GPU:使用GPU进行计算加速。

CPU
PageNumberlong

实例列表的页码。起始值为1,默认为1。

1
PageSizelong

分页查询时设置的每页显示的实例数量。

10
SortBystring

按字段gmtCreate排序。

gmtCreate
Orderstring

排列顺序。取值如下:

  • DESC:降序。
  • ASC:升序。
DESC
InstanceIdstring

按实例ID过滤。如何获取实例ID,请参见ListInstances

dsw-730xxxxxxxxxx

返回参数

名称类型描述示例值
object

实例列表。

RequestIdstring

请求ID。

E7D55162-4489-1619-AAF5-3F97D5FCA948
Successboolean

成功标志,可能值:

  • true
  • false
true
Messagestring

返回结果说明。

"XXX"
Codestring

状态码,可能值:

  • InternalError:内部错误(除了参数验证错误外的其他错误,目前都归类到内部错误)。
  • ValidationError:参数验证错误。
null
HttpStatusCodeinteger

HTTP状态码,可能值:

  • 400
  • 404
null
TotalCountlong

实例总数。

35
Instancesarray

本分页中请求的实例列表。

object

实例对象。

WorkspaceIdstring

工作空间ID。

40823
WorkspaceNamestring

工作空间名称。

training_data
InstanceIdstring

实例ID。

dsw-730xxxxxxxxxx
InstanceNamestring

实例名称。

training_data
EcsSpecstring

实例对应的ECS规格。

ecs.c6.large
Statusstring

实例状态。

Running
InstanceUrlstring

实例Url。

https://dsw-cn-shanghai.data.aliyun.com/notebook.htm?instance=39772#/
JupyterlabUrlstring

Jupyterlab Url。

https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/lab/
WebIDEUrlstring

Web IDE url。

https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/ide/
TerminalUrlstring

终端url。

https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/tty/
AccumulatedRunningTimeInMslong

累计运行时间,单位为毫秒。

3600000
ImageIdstring

镜像ID。

image-05cefd0be2exxxx
ImageUrlstring

镜像地址。

registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu
ImageNamestring

镜像名称。

py36_cpu_tf1.12_ubuntu
GmtCreateTimestring

实例创建时间。

2021-01-12T14:36:01Z
GmtModifiedTimestring

实例修改时间。

2021-01-12T14:36:01Z
UserIdstring

用户ID。

1612285282502324
UserNamestring

用户名称。

测试用户
Datasetsarray

数据集集合。

object

数据集对象

DatasetIdstring

数据集ID。

d-vsqjvsjp4orp5l206u
MountPathstring

容器内挂载路径。

/mnt/data
UserVpcobject

User VPC配置。

VpcIdstring

VPC ID。

vpc-xxxxx
VSwitchIdstring

交换机ID。

vsw-xxxxx
SecurityGroupIdstring

安全组ID。

sg-xxxxxx
InstanceShutdownTimerobject

定时关机任务。

InstanceIdstring

实例ID。

dsw-730xxxxxxxxxx
GmtCreateTimestring

创建时间。

2021-01-12T14:36:01Z
GmtModifiedTimestring

修改时间。

2021-01-12T14:36:01Z
DueTimestring

设定关机时间。

2021-01-12T14:36:01Z
RemainingTimeInMslong

剩余关机时间,单位为毫秒。

3600000
ReasonCodestring

实例错误代码。

Internal Error
ReasonMessagestring

实例错误原因。

ImagePullBackOff
PaymentTypestring

支付类型,可能值:

  • PayAsYouGo:后付费(后付费/按量付费)。
  • Subscription:预付费(预付费/包年包月)。
PayAsYouGo
LatestSnapshotobject

最新保存的用户镜像。

ImageIdstring

镜像ID。

image-05cefd0be2exxxx
ImageNamestring

镜像名称。

py36_cpu_tf1.12_ubuntu
ImageUrlstring

镜像Url。

registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu
RepositoryUrlstring

镜像仓库Url。

https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images
GmtCreateTimestring

快照创建时间。

2021-01-12T14:36:01Z
GmtModifiedTimestring

快照修改时间。

2021-01-12T14:36:01Z
ReasonCodestring

实例快照错误代码。

Internal Error
ReasonMessagestring

实例快照错误消息。

ImagePullBackOff
Statusstring

实例快照状态。

Pushing
AcceleratorTypestring

实例计算类型。可能值:

  • CPU
  • GPU
CPU
Accessibilitystring

工作空间内是否他人可见。可能值:

  • PRIVATE(默认值):表示工作空间内自己以及管理员可见。
  • PUBLIC:为工作空间所有用户可见。
PRIVATE
EnvironmentVariablesobject

环境变量。

string

用户指定环境变量。DSW实例启动后,指定环境变量会被注入到容器中。

MAAS
ResourceIdstring

资源ID,预付费时填写。

dsw-123456789
ResourceNamestring

资源规格。

  • 后付费场景,资源规格为购买的ECS规格。
  • 预付费场景,资源规格为请求的CPU核数与内存大小。
resource_group
Prioritylong

优先级,在分配资源给实例时,优先级越高的实例越优先。

1
RequestedResourceobject

资源配置,弹内或者轻量化时使用。

CPUstring

CPU核数。

32
Memorystring

内存大小。

32
SharedMemorystring

共享内存大小。

32
GPUstring

GPU数量。

4
GPUTypestring

GPU显卡类型。

v100
Labelsarray

用户自定义标签。

object

用户定义标签。

Keystring

用户定义标签键值。

stsTokenOwner
Valuestring

用户定义标签值。

123xxxxxxxx
IdleInstanceCullerobject

实例闲置关机规则。

InstanceIdstring

实例ID。

dsw-730xxxxxxxxxx
CpuPercentThresholdinteger

CPU使用率阈值,单位是百分比,取值1~100,低于此值则认为实例当前处于闲置。

20
GpuPercentThresholdinteger

GPU使用率阈值,单位是百分比,取值1~100。如果实例为GPU类型,则此参数生效。CPU和GPU同时低于阈值则认为指定实例处于闲置。

10
MaxIdleTimeInMinutesinteger

闲置等待时间阈值,单位是分钟。如果闲置时长超过此值,将自动停止DSW实例。

60
IdleTimeInMinutesinteger

实例当前闲置时长,单位是分钟。

30
InstanceSnapshotListarray

实例快照列表。

object

实例快照。

ImageIdstring

镜像ID。

image-05cefd0be2exxxx
ImageNamestring

镜像名称。

py36_cpu_tf1.12_ubuntu
ImageUrlstring

镜像Url。

registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu
RepositoryUrlstring

镜像仓库Url。

https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images
GmtCreateTimestring

快照创建时间。

2021-01-12T14:36:01Z
GmtModifiedTimestring

快照修改时间。

2021-01-12T14:36:01Z
ReasonCodestring

实例快照错误代码。

Internal Error
ReasonMessagestring

实例快照错误消息。

ImagePullBackOff
Statusstring

实例快照状态。

Pushing

示例

正常返回示例

JSON格式

{
  "RequestId": "E7D55162-4489-1619-AAF5-3F97D5FCA948",
  "Success": true,
  "Message": "\"XXX\"",
  "Code": "null",
  "HttpStatusCode": 0,
  "TotalCount": 35,
  "Instances": [
    {
      "WorkspaceId": "40823",
      "WorkspaceName": "training_data",
      "InstanceId": "dsw-730xxxxxxxxxx",
      "InstanceName": "training_data",
      "EcsSpec": "ecs.c6.large",
      "Status": "Running",
      "InstanceUrl": "https://dsw-cn-shanghai.data.aliyun.com/notebook.htm?instance=39772#/",
      "JupyterlabUrl": "https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/lab/",
      "WebIDEUrl": "https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/ide/",
      "TerminalUrl": "https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/tty/",
      "AccumulatedRunningTimeInMs": 3600000,
      "ImageId": "image-05cefd0be2exxxx",
      "ImageUrl": "registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu",
      "ImageName": "py36_cpu_tf1.12_ubuntu",
      "GmtCreateTime": "2021-01-12T14:36:01Z",
      "GmtModifiedTime": "2021-01-12T14:36:01Z",
      "UserId": "1612285282502324",
      "UserName": "测试用户",
      "Datasets": [
        {
          "DatasetId": "d-vsqjvsjp4orp5l206u",
          "MountPath": "/mnt/data"
        }
      ],
      "UserVpc": {
        "VpcId": "vpc-xxxxx",
        "VSwitchId": "vsw-xxxxx",
        "SecurityGroupId": "sg-xxxxxx",
        "ExtendedCIDRs": [
          ""
        ]
      },
      "InstanceShutdownTimer": {
        "InstanceId": "dsw-730xxxxxxxxxx",
        "GmtCreateTime": "2021-01-12T14:36:01Z",
        "GmtModifiedTime": "2021-01-12T14:36:01Z",
        "DueTime": "2021-01-12T14:36:01Z",
        "RemainingTimeInMs": 3600000
      },
      "ReasonCode": "Internal Error",
      "ReasonMessage": "ImagePullBackOff",
      "PaymentType": "PayAsYouGo",
      "LatestSnapshot": {
        "ImageId": "image-05cefd0be2exxxx",
        "ImageName": "py36_cpu_tf1.12_ubuntu",
        "ImageUrl": "registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu",
        "RepositoryUrl": "https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images",
        "GmtCreateTime": "2021-01-12T14:36:01Z",
        "GmtModifiedTime": "2021-01-12T14:36:01Z",
        "ReasonCode": "Internal Error",
        "ReasonMessage": "ImagePullBackOff",
        "Status": "Pushing"
      },
      "AcceleratorType": "CPU",
      "Accessibility": "PRIVATE",
      "EnvironmentVariables": {
        "key": "MAAS"
      },
      "ResourceId": "dsw-123456789",
      "ResourceName": "resource_group",
      "Priority": 1,
      "RequestedResource": {
        "CPU": "32",
        "Memory": "32",
        "SharedMemory": "32",
        "GPU": "4",
        "GPUType": "v100"
      },
      "Labels": [
        {
          "Key": "stsTokenOwner",
          "Value": "123xxxxxxxx"
        }
      ],
      "IdleInstanceCuller": {
        "InstanceId": "dsw-730xxxxxxxxxx",
        "CpuPercentThreshold": 20,
        "GpuPercentThreshold": 10,
        "MaxIdleTimeInMinutes": 60,
        "IdleTimeInMinutes": 30
      },
      "InstanceSnapshotList": [
        {
          "ImageId": "image-05cefd0be2exxxx",
          "ImageName": "py36_cpu_tf1.12_ubuntu",
          "ImageUrl": "registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu",
          "RepositoryUrl": "https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images",
          "GmtCreateTime": "2021-01-12T14:36:01Z",
          "GmtModifiedTime": "2021-01-12T14:36:01Z",
          "ReasonCode": "Internal Error",
          "ReasonMessage": "ImagePullBackOff",
          "Status": "Pushing"
        }
      ]
    }
  ]
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2023-05-06OpenAPI 返回结构发生变更
变更项变更内容
出参OpenAPI 返回结构发生变更
2022-01-20OpenAPI 返回结构发生变更
变更项变更内容
出参OpenAPI 返回结构发生变更
2022-01-20OpenAPI 返回结构发生变更
变更项变更内容
出参OpenAPI 返回结构发生变更
阿里云首页 机器学习平台 PAI 相关技术圈