计算
弹性云服务器 ECS
Flexus云服务
裸金属服务器 BMS
弹性伸缩 AS
镜像服务 IMS
专属主机 DeH
函数工作流 FunctionGraph
云手机服务器 CPH
Huawei Cloud EulerOS
网络
虚拟私有云 VPC
弹性公网IP EIP
虚拟专用网络 VPN
弹性负载均衡 ELB
NAT网关 NAT
云专线 DC
VPC终端节点 VPCEP
云连接 CC
企业路由器 ER
企业交换机 ESW
全球加速 GA
安全与合规
安全技术与应用
Web应用防火墙 WAF
企业主机安全 HSS
云防火墙 CFW
安全云脑 SecMaster
DDoS防护 AAD
数据加密服务 DEW
数据库安全服务 DBSS
云堡垒机 CBH
数据安全中心 DSC
云证书管理服务 CCM
边缘安全 EdgeSec
威胁检测服务 MTD
CDN与智能边缘
内容分发网络 CDN
CloudPond云服务
智能边缘云 IEC
迁移
主机迁移服务 SMS
对象存储迁移服务 OMS
云数据迁移 CDM
迁移中心 MGC
大数据
MapReduce服务 MRS
数据湖探索 DLI
表格存储服务 CloudTable
云搜索服务 CSS
数据接入服务 DIS
数据仓库服务 GaussDB(DWS)
数据治理中心 DataArts Studio
数据可视化 DLV
数据湖工厂 DLF
湖仓构建 LakeFormation
企业应用
云桌面 Workspace
应用与数据集成平台 ROMA Connect
云解析服务 DNS
专属云
专属计算集群 DCC
IoT物联网
IoT物联网
设备接入 IoTDA
智能边缘平台 IEF
用户服务
账号中心
费用中心
成本中心
资源中心
企业管理
工单管理
国际站常见问题
ICP备案
我的凭证
支持计划
客户运营能力
合作伙伴支持计划
专业服务
区块链
区块链服务 BCS
Web3节点引擎服务 NES
解决方案
SAP
高性能计算 HPC
视频
视频直播 Live
视频点播 VOD
媒体处理 MPC
实时音视频 SparkRTC
数字内容生产线 MetaStudio
存储
对象存储服务 OBS
云硬盘 EVS
云备份 CBR
存储容灾服务 SDRS
高性能弹性文件服务 SFS Turbo
弹性文件服务 SFS
云硬盘备份 VBS
云服务器备份 CSBS
数据快递服务 DES
专属分布式存储服务 DSS
容器
云容器引擎 CCE
容器镜像服务 SWR
应用服务网格 ASM
华为云UCS
云容器实例 CCI
管理与监管
云监控服务 CES
统一身份认证服务 IAM
资源编排服务 RFS
云审计服务 CTS
标签管理服务 TMS
云日志服务 LTS
配置审计 Config
资源访问管理 RAM
消息通知服务 SMN
应用运维管理 AOM
应用性能管理 APM
组织 Organizations
优化顾问 OA
IAM 身份中心
云运维中心 COC
资源治理中心 RGC
应用身份管理服务 OneAccess
数据库
云数据库 RDS
文档数据库服务 DDS
数据管理服务 DAS
数据复制服务 DRS
云数据库 GeminiDB
云数据库 GaussDB
分布式数据库中间件 DDM
数据库和应用迁移 UGO
云数据库 TaurusDB
人工智能
人脸识别服务 FRS
图引擎服务 GES
图像识别 Image
内容审核 Moderation
文字识别 OCR
AI开发平台ModelArts
图像搜索 ImageSearch
对话机器人服务 CBS
华为HiLens
视频智能分析服务 VIAS
语音交互服务 SIS
应用中间件
分布式缓存服务 DCS
API网关 APIG
微服务引擎 CSE
分布式消息服务Kafka版
分布式消息服务RabbitMQ版
分布式消息服务RocketMQ版
多活高可用服务 MAS
事件网格 EG
企业协同
华为云会议 Meeting
云通信
消息&短信 MSGSMS
云生态
合作伙伴中心
云商店
开发者工具
SDK开发指南
API签名指南
Terraform
华为云命令行工具服务 KooCLI
其他
产品价格详情
系统权限
管理控制台
客户关联华为云合作伙伴须知
消息中心
公共问题
开发与运维
应用管理与运维平台 ServiceStage
软件开发生产线 CodeArts
需求管理 CodeArts Req
部署 CodeArts Deploy
性能测试 CodeArts PerfTest
编译构建 CodeArts Build
流水线 CodeArts Pipeline
制品仓库 CodeArts Artifact
测试计划 CodeArts TestPlan
代码检查 CodeArts Check
代码托管 CodeArts Repo
云应用引擎 CAE
开天aPaaS
云消息服务 KooMessage
云手机服务 KooPhone
云空间服务 KooDrive
本文导读

开发环境的应用示例

更新时间:2024-05-30 GMT+08:00

本节通过调用一系列API,以创建开发环境实例为例介绍ModelArts API的使用流程。

概述

创建开发环境实例的流程如下:

  1. 调用认证鉴权接口获取用户Token,在后续的请求中需要将Token放到请求消息头中作为认证。
  2. 调用查询支持的镜像列表接口查看开发环境的镜像类型和版本。
  3. 调用创建Notebook实例接口创建一个Notebook实例。
  4. 调用查询Notebook实例详情接口根据Notebook实例的ID查询实例的创建详情。
  5. 调用Notebook时长续约接口重置Notebook实例的使用时长。
  6. 调用停止Notebook实例接口停止正在运行的实例。
  7. 调用启动Notebook实例接口重新启动实例。
  8. 当Notebook实例不再需要时,调用删除Notebook实例接口删除实例。

前提条件

操作步骤

  1. 调用认证鉴权接口获取用户的Token。
    1. 请求消息体:

      URI格式:POST https://{iam_endpoint}/v3/auth/tokens

      请求消息头:Content-Type →application/json

      请求Body:
      {
        "auth": {
          "identity": {
            "methods": ["password"],
            "password": {
              "user": {
                "name": "user_name", 
                "password": "user_password",
                "domain": {
                  "name": "domain_name"  
                }
              }
            }
          },
          "scope": {
            "project": {
              "name": "ap-southeast-1"  
            }
          }
        }
      }
      其中,加粗的斜体字段需要根据实际值填写:
      • iam_endpoint为IAM的终端节点。
      • user_name为IAM用户名。
      • user_password为用户登录密码。
      • domain_name为用户所属的账号名。
      • ap-southeast-1为项目名,代表服务的部署区域。
    2. 返回状态码“201 Created”,在响应Header中获取“X-Subject-Token”的值即为Token,如下所示:
      x-subject-token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
  2. 调用查询支持的镜像列表接口查看开发环境的镜像类型和版本。

    1. 请求消息体:

      URI格式:GET https://{ma_endpoint}/v1/{project_id}/images

      请求消息头:
      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      其中,加粗的斜体字段需要根据实际值填写:

      • ma_endpoint为ModelArts的终端节点。
      • project_id为用户的项目ID。
      • “X-auth-Token”的值是上一步获取到的Token值。
    2. 返回状态码为“200”,响应Body如下所示:

      {
       "current": 0,
       "data": [
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine PyTorch1.8",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "278e88d1-5b71-4766-8502-b3ba72e824d9",
         "name": "pytorch1.8-cuda10.2-cudnn7-ubuntu18.04",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "COMMON",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/pytorch_1_8:pytorch_1.8.0-cuda_10.2-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tag": "pytorch_1.8.0-cuda_10.2-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866992843,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine MindSpore1.7.0 and cuda10.1",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54202",
         "name": "mindspore1.7.0-cuda10.1-py3.7-ubuntu18.04",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tag": "mindspore_1.7.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU general algorithm development and training, preconfigured with AI engine MindSpore1.7.0",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "c0b31f09-1490-4555-9b8b-ab0b2de35b20",
         "name": "mindspore1.7.0-py3.7-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tag": "mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine TensorFlow2.1",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54100",
         "name": "tensorflow2.1-cuda10.1-cudnn7-ubuntu18.04",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "COMMON",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/tensorflow_2_1:tensorflow_2.1.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20221121111529-d65d817",
         "tag": "tensorflow_2.1.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20221121111529-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1643166780367,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine PyTorch1.10 and cuda10.2",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "d996b661-e127-48c4-a90a-fca29535f201",
         "name": "pytorch1.10-cuda10.2-cudnn7-ubuntu18.04",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "UNKNOWN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/pytorch_1_10:pytorch_1.10.2-cuda_10.2-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tag": "pytorch_1.10.2-cuda_10.2-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "Clean user customized base image include cuda10.2, conda",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "d937149a-785c-4d2d-a568-8dde7c06cca0",
         "name": "conda3-cuda10.2-cudnn7-ubuntu18.04",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "UNKNOWN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/user_defined_base:cuda_10.2-ubuntu_18.04-x86_64-20230404095316-7fcd503",
         "tag": "cuda_10.2-ubuntu_18.04-x86_64-20230404095316-7fcd503",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "Clean user customized base image only include conda",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "27542a4a-3b37-404d-add9-a7d2d2ce6893",
         "name": "conda3-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "UNKNOWN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/user_defined_base:ubuntu_18.04-x86_64-20230404095316-7fcd503",
         "tag": "ubuntu_18.04-x86_64-20230404095316-7fcd503",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine PyTorch1.4",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54099",
         "name": "pytorch1.4-cuda10.1-cudnn7-ubuntu18.04",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/pytorch_1_4:pytorch_1.4-cuda_10.1-py37-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tag": "pytorch_1.4-cuda_10.1-py37-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866992868,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "GPU algorithm development and training, preconfigured with AI engine TensorFlow1.13.1",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "b80bbf3d-a7af-42f6-ad12-33ff9116ab0d",
         "name": "tensorflow1.13-cuda10.0-cudnn7-ubuntu18.04",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/tensorflow_1_13:tensorflow_1.13-cuda_10.0-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tag": "tensorflow_1.13-cuda_10.0-py_3.7-ubuntu_18.04-x86_64-20221118143845-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866992960,
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "create_at": 1608937196685,
         "description": "Ascend+ARM algorithm development and training. TensorFlow and MindSpore are preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "59a6e9f5-93c0-44dd-85b0-82f390c5d53a",
         "name": "tensorflow1.15-mindspore1.7.0-cann5.1.0-euler2.8-aarch64",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-arm-ascend-cp37:5.0.1-c81-20220726",
         "tag": "5.0.1-c81-20220726",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866992983,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "AI inference application development, preconfigured ModelBox and AI engine LibTorch, only SSH connection supported.",
         "dev_services": [
          "AI_FLOW",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54103",
         "name": "modelbox1.3.0-libtorch1.9.1-cuda10.2-cudnn8-euler2.9.6",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/modelarts-modelbox-libtorch-gpu-x86:1.3.0-20221223142251-b3da6d6",
         "tag": "1.3.0-20221223142251-b3da6d6",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866993005,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "AI inference application development, preconfigured ModelBox and AI engine TensorRT, only SSH connection supported.",
         "dev_services": [
          "AI_FLOW",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54101",
         "name": "modelbox1.3.0-tensorrt7.1.3-cuda10.2-cudnn8-euler2.9.6",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/modelarts-modelbox-tensorrt-gpu-x86:1.3.0-20221223142251-b3da6d6",
         "tag": "1.3.0-20221223142251-b3da6d6",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866993030,
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "description": "Ascend operator development. The professional operator development tool MindStudio is preconfigured, only SSH connection supported.",
         "dev_services": [
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54088",
         "name": "mindstudio5.0.rc1-ascendsnt9-cann5.1.0-euler2.8.3-aarch64",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindstudio-modelarts-image:5.0.rc1-20230322101430-75f458a",
         "tag": "5.0.rc1-20230322101430-75f458a",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648866993052,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU algorithm development and training, preconfigured PySpark 2.4.5 and scala 2.11.12 for code development in local notebook and remote spark cluster including MRS and DLI",
         "dev_services": [
          "NOTEBOOK"
         ],
         "id": "0b2d0728-4c01-11ec-994f-001a7dda7112",
         "name": "spark2.4.5-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/pyspark_2_4_5:develop-remote-pyspark_2.4.5-py_3.7-cpu-ubuntu_18.04-x86_64-uid1000-20221222203856-fcc979e",
         "tag": "develop-remote-pyspark_2.4.5-py_3.7-cpu-ubuntu_18.04-x86_64-uid1000-20221222203856-fcc979e",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648867218663,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1605759392357,
         "description": "CPU algorithm development and training, preconfigured with the AI engine MindSpore-CPU",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "65f636a0-56cf-49df-b941-7d2a07ba8c8c",
         "name": "mindspore1.2.0-openmpi2.1.1-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_2_0:mindspore_1.2.0-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tag": "mindspore_1.2.0-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1643166780389,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1664501979865,
         "description": "",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "df78b3f7-98a4-4616-aef0-71cfff4195c9",
         "name": "spark",
         "namespace": "testdli002",
         "origin": "CUSTOMIZE",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "UNKNOWN",
         "size": 1133670676,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/testdli002/spark:2.4.5.tensorflow",
         "tag": "2.4.5.tensorflow",
         "tags": [],
         "type": "DEDICATED",
         "update_at": 1664501979865,
         "visibility": "PRIVATE",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1664513619044,
         "description": "",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "836ab55d-4a02-4dbb-b04f-ece555d642a8",
         "name": "tensorflow2_1_1",
         "namespace": "hwstaff_pub_cbuinfo_ei",
         "origin": "IMAGE_SAVE",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "COMMON",
         "size": 5094544544,
         "status": "ERROR",
         "status_message": "",
         "swr_path": "swr.myhuaweicloud.com/hwstaff_pub_cbuinfo_ei/tensorflow2_1_1:1.0.0",
         "tag": "1.0.0",
         "tags": [],
         "type": "DEDICATED",
         "update_at": 1664513676950,
         "visibility": "PRIVATE",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1668482562290,
         "description": "test",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "689c81b3-15dd-4500-b63e-1871e24eb391",
         "name": "pytorch_1_8",
         "namespace": "atelier",
         "origin": "CUSTOMIZE",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "UNKNOWN",
         "size": 8285974481,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/pytorch_1_8:pytorch_1.8.2-cuda_11.1-py_3.7-ubuntu_18.04-x86_64-20220926104358-041ba2e",
         "tag": "pytorch_1.8.2-cuda_11.1-py_3.7-ubuntu_18.04-x86_64-20220926104358-041ba2e",
         "tags": [],
         "type": "DEDICATED",
         "update_at": 1668482562290,
         "visibility": "PRIVATE",
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "description": "Ascend+ARM algorithm development and training. MindSpore is preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "f6d0908e-9596-41f9-9843-83089cbdd0de",
         "name": "mindspore1.7.0-cann5.1.0-py3.7-euler2.8.3",
         "namespace": "atelier",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "UNKNOWN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cann_5.1.0-py_3.7-euler_2.8.3-aarch64-snt9-20220906",
         "tag": "mindspore_1.7.0-cann_5.1.0-py_3.7-euler_2.8.3-aarch64-snt9-20220906",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "description": "Ascend+ARM algorithm development and training. TensorFlow is preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "c5b7507b-ca8d-48d5-a373-fe4b42c66ed8",
         "name": "tensorflow1.15-cann5.1.0-py3.7-euler2.8.3",
         "namespace": "atelier",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "UNKNOWN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/tensorflow_1_15_ascend:tensorflow_1.15-cann_5.1.0-py_3.7-euler_2.8.3-aarch64-snt9-20220906",
         "tag": "tensorflow_1.15-cann_5.1.0-py_3.7-euler_2.8.3-aarch64-snt9-20220906",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1678261148079,
         "description": "",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1ab81ef-f452-46b5-9663-6fc1f982f9e9",
         "name": "grafana",
         "namespace": "hwstaff_pub_cbuinfo_ei",
         "origin": "IMAGE_SAVE",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "COMMON",
         "size": 5247805223,
         "status": "ACTIVE",
         "status_message": "",
         "swr_path": "swr.myhuaweicloud.com/hwstaff_pub_cbuinfo_ei/grafana:v1.0",
         "tag": "v1.0",
         "tags": [],
         "type": "DEDICATED",
         "update_at": 1678261330238,
         "visibility": "PRIVATE",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1681973786157,
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "a5a43175-30a6-43d2-9596-38bee562f8c0",
         "name": "pytorch_1_8",
         "namespace": "sdk-test2",
         "origin": "CUSTOMIZE",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "UNKNOWN",
         "size": 2308736380,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/sdk-test2/pytorch_1_8:v2",
         "tag": "v2",
         "tags": [],
         "type": "DEDICATED",
         "update_at": 1681973786157,
         "visibility": "PRIVATE",
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "create_at": 1682670088194,
         "description": "Ascend+ARM algorithm development and training. MindSpore is preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "75cbf0f2-0a3e-48c9-b2c4-7e78af18d86e",
         "name": "mindspore_1.9.0-cann_6.0.0-py_3.7-euler_2.8.3",
         "namespace": "atelier",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "TRAIN",
         "size": 4011027643,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_9_ascend:mindspore_1.9.0-cann_6.0.0-py_3.7-euler_2.8.3-aarch64-snt9-20221116111529",
         "tag": "mindspore_1.9.0-cann_6.0.0-py_3.7-euler_2.8.3-aarch64-snt9-20221116111529",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1682670088197,
         "visibility": "PUBLIC",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "notebook2.0 gpu",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54092",
         "name": "notebook2.0-mul-kernel-cpu-cp36",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-gpu-cp36:5.0.1-release-v2-20220505",
         "tag": "5.0.1-release-v2-20220505",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1628221753209,
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "create_at": 1683537880541,
         "description": "Ascend+ARM algorithm development and training. MindSpore is preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "31ae7ba4-63e6-4fa6-8aeb-cb382953e414",
         "name": "mindspore_1.10.0-cann_6.0.1-py_3.7-euler_2.8.3",
         "namespace": "atelier",
         "resource_categories": [
          "ASCEND"
         ],
         "service_type": "COMMON",
         "size": 4057170552,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_10_ascend:mindspore_1.10.0-cann_6.0.1-py_3.7-euler_2.8.3-aarch64-snt9-20230303173945-815d627",
         "tag": "mindspore_1.10.0-cann_6.0.1-py_3.7-euler_2.8.3-aarch64-snt9-20230303173945-815d627",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1683537880548,
         "visibility": "PUBLIC",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU algorithm development and training, including the MLStudio tool for graphical ML algorithm development, and preconfigured PySpark 2.3.2",
         "dev_services": [
          "NOTEBOOK"
         ],
         "id": "0e5f9a41-c9c2-4d9a-a190-4e1b17a7782f",
         "name": "mlstudio-pyspark2.3.2-ubuntu16.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mlstudio-cp36:3.3.1.9",
         "tag": "3.3.1.9",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648867218685,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "notebook2.0 cpu base image",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54090",
         "name": "notebook2.0-mul-kernel-cpu-cp36",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-cpu-cp36:5.0.1-release-v2-20220505",
         "tag": "5.0.1-release-v2-20220505",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1628221753345,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "GPU algorithm development and training, preconfigured with the AI engine MindSpore-GPU",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "d7fb5355-9045-4deb-94c6-4033e1e62728",
         "name": "mindspore1.2.0-openmpi2.1.1-ubuntu18.04",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_2_0:mindspore_1.2.0-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tag": "mindspore_1.2.0-py_3.7-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1636963735672,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1628757809703,
         "description": "CPU operations research development, preconfigured with cylp, cbcpy, ortools, cplex(community).",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "b9933af0-3119-4045-a427-5e668327dafd",
         "name": "cylp0.91.4-cbcpy2.10-ortools9.0-cplex20.1.0-ubuntu18.04",
         "namespace": "atelier",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "size": 2550402546,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/or_1_0_0:or_1.0.0-py_3.7-ubuntu_18.04-x86_64-roma-20220812093355-e50493d",
         "tag": "or_1.0.0-py_3.7-ubuntu_18.04-x86_64-roma-20220812093355-e50493d",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1642836699554,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU algorithm development and training, including the MLStudio tool for graphical ML algorithm development, and preconfigured PySpark 2.4.5",
         "dev_services": [
          "NOTEBOOK"
         ],
         "id": "0b2d0728-4c01-11ec-994f-001a7dda7111",
         "name": "mlstudio-pyspark2.4.5-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mlstudio-cp37:5.0.1-mls-20230118153946",
         "tag": "5.0.1-mls-20230118153946",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648867218708,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1605759392404,
         "description": "GPU algorithm development and training, preconfigured with the AI engine MindSpore-GPU",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "89de30ec-6871-4f22-84af-be37ef28335d",
         "name": "mindspore1.2.0-cuda10.1-cudnn7-ubuntu18.04",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_2_0:mindspore_1.2.0-py_3.7-cuda_10.1-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tag": "mindspore_1.2.0-py_3.7-cuda_10.1-ubuntu_18.04-x86_64-20221118143809-d65d817",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1648867218639,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "description",
         "dev_services": [
          "NOTEBOOK"
         ],
         "id": "88bd7bcd-0c91-45b2-ad0e-ef65553d19c5",
         "name": "dls-feature-engineering",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-dls-feature-engineering-cpu-py37:3.2.0109",
         "tag": "3.2.0109",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1623899358020,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "description",
         "dev_services": [
          "NOTEBOOK"
         ],
         "id": "1d1b1327-b243-425b-ad81-2689584c1acc",
         "name": "mls-feature-engineering",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-mls-feature-engineering-cpu-py37:3.2.0109",
         "tag": "3.2.0109",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1623899357995,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "MindSpore1.7.0 and MindQuantum0.6.0",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "6592fa02-a40a-4054-a05f-f22215e45ec1",
         "name": "mindquantum0.6.0-mindspore1.7.0-ubuntu18.04",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20220727174747-6a4cdd5",
         "tag": "mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20220727174747-6a4cdd5",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "create_at": 1628757853111,
         "description": "CPU and GPU algorithm development and training, preconfigured with AI engine ray for reinforcement learning.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "4233d6f9-c3b5-4cf2-9ee6-2ef565935d6d",
         "name": "rlstudio1.0.0-ray1.3.0-cuda10.1-ubuntu18.04",
         "namespace": "rl-dev",
         "resource_categories": [
          "CPU",
          "GPU"
         ],
         "service_type": "TRAIN",
         "size": 4857883146,
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-rl-1.0.0-kernel-cp37:rl-v1220211203",
         "tag": "rl-v1220211203",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1642836699527,
         "workspace_id": "0"
        },
        {
         "arch": "aarch64",
         "description": "Ascend+ARM algorithm development and training. TensorFlow and MindSpore are preset in the AI engine.",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "59a6e9f5-93c0-44dd-85b0-82f390c5d53b",
         "name": "tensorflow1.15-mindspore1.7.0-cann5.1.0-euler2.8-aarch64",
         "resource_categories": [
          "CPU",
          "ASCEND"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-arm-ascend-cp37:5.0.1-c81-20220726",
         "tag": "5.0.1-c81-20220726",
         "tags": [],
         "type": "BUILD_IN",
         "update_at": 1640398185602,
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU general algorithm development and training, preconfigured with AI engine MindSpore1.7.0",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "9d63f4d1-dc09-4873-b669-3483cea777c0",
         "name": "mindspore1.7.0-ubuntu18.04-default",
         "resource_categories": [
          "CPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20220625205423-5a13f29",
         "tag": "mindspore_1.7.0-cpu-py_3.7-ubuntu_18.04-x86_64-20220625205423-5a13f29",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        },
        {
         "arch": "x86_64",
         "description": "CPU and GPU general algorithm development and training, preconfigured with AI engine MindSpore1.7.0 and cuda10.1",
         "dev_services": [
          "NOTEBOOK",
          "SSH"
         ],
         "id": "e1a07296-22a8-4f05-8bc8-e936c8e54203",
         "name": "mindspore1.7.0-ubuntu18.04-default",
         "resource_categories": [
          "GPU"
         ],
         "service_type": "TRAIN",
         "status": "ACTIVE",
         "swr_path": "swr.myhuaweicloud.com/atelier/mindspore_1_7_0:mindspore_1.7.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20220625205423-5a13f29",
         "tag": "mindspore_1.7.0-cuda_10.1-py_3.7-ubuntu_18.04-x86_64-20220625205423-5a13f29",
         "tags": [],
         "type": "BUILD_IN",
         "workspace_id": "0"
        }
       ],
       "pages": 1,
       "size": 200,
       "total": 39
      }

      根据“description”“name”字段选择创建Notebook实例所需要的镜像,并记录对应的“id”,本章以TensorFlow引擎为例创建Notebook实例,记录“id”"e1a07296-22a8-4f05-8bc8-e936c8e54100"

  3. 调用创建Notebook实例接口创建一个Notebook实例。

    1. 请求消息体:

      URI格式:POST https://{ma_endpoint}/v1/{project_id}/notebooks

      请求消息头:
      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      请求Body:

      {
        "name" : "notebooks_test",
        "feature" : "NOTEBOOK",
        "workspace_id" : "0",
        "description" : "api-test",
        "flavor" : "modelarts.vm.cpu.2u",
        "image_id" : "e1a07296-22a8-4f05-8bc8-e936c8e54090",
        "volume" : {
          "category" : "efs",
          "ownership" : "managed",
          "capacity" : 50
        }
      }
      其中,加粗的斜体字段需要根据实际值填写
      • ma_endpoint为ModelArts的终端节点。
      • project_id为用户的项目ID。
      • X-auth-Token的值是上一步获取到的Token值。
      • flavor为Notebook实例规格
      • image_id为Notebook实例镜像ID
    2. 返回状态码为“200”,响应Body如下所示:
      {
       "action_progress": [
        {
         "step": 4,
         "status": "WAITING",
         "description": "Initialize the notebook instance."
        },
        {
         "step": 3,
         "status": "WAITING",
         "description": "Configuring the network."
        },
        {
         "step": 2,
         "status": "WAITING",
         "description": "Prepare the compute resource."
        },
        {
         "step": 1,
         "status": "WAITING",
         "description": "Prepare the storage."
        }
       ],
       "create_at": 1687656452472,
       "description": "api-test",
       "endpoints": [],
       "feature": "NOTEBOOK",
       "flavor": "modelarts.vm.cpu.2u",
       "id": "936bea3e-d3df-435e-8b58-d817283284ae",
       "image": {
        "description": "",
        "id": "e1a07296-22a8-4f05-8bc8-e936c8e54090",
        "name": "notebook2.0-mul-kernel-cpu-cp36",
        "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-cpu-cp36:5.0.1-release-v2-20220505",
        "tag": "5.0.1-release-v2-20220505",
        "type": "BUILD_IN"
       },
       "lease": {
        "create_at": 1687656452470,
        "duration": 3600000,
        "enable": true,
        "type": "TIMING",
        "update_at": 1687656452470
       },
       "name": "notebooks_test",
       "status": "RUNNING",
       "tags": [],
       "token": "3452e0d5-15fe-a20d-18a2-010a574aeaaf",
       "update_at": 1687656452588,
       "user_id": "99250e439b33431081xxxxxxxxxxa885",
       "workspace_id": "0",
       "billing_items": []
      }

      根据响应可以了解Notebook实例详情,其中“status”“RUNNING”表示Notebook实例创建成功。

  4. 调用查询Notebook实例详情接口根据Notebook实例的ID查询实例的创建详情。
    1. 请求消息体:

      URI格式:GET https://{ma_endpoint}/v1/{project_id}/notebooks/{id}

      请求消息头:X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...

      其中,加粗的斜体字段需要根据实际值填写。

    2. 返回状态码为“200”,响应Body如下所示:
      {
       "create_at": 1687656452472,
       "data_volumes": [],
       "description": "api-test",
       "endpoints": [
        {
         "service": "NOTEBOOK",
         "uri": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab"
        }
       ],
       "feature": "NOTEBOOK",
       "flavor": "modelarts.vm.cpu.2u",
       "id": "936bea3e-d3df-435e-8b58-d817283284ae",
       "image": {
        "description": "",
        "id": "e1a07296-22a8-4f05-8bc8-e936c8e54090",
        "name": "notebook2.0-mul-kernel-cpu-cp36",
        "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-cpu-cp36:5.0.1-release-v2-20220505",
        "tag": "5.0.1-release-v2-20220505",
        "type": "BUILD_IN"
       },
       "lease": {
        "create_at": 1687656452470,
        "duration": 3627372,
        "enable": true,
        "type": "TIMING",
        "update_at": 1687656479842
       },
       "name": "notebooks_test",
       "status": "RUNNING",
       "tags": [],
       "token": "3452e0d5-15fe-a20d-18a2-010a574aeaaf",
       "update_at": 1687656479880,
       "url": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab",
       "user": {
        "domain": {
         "id": "878991804cdc4ba597xxxxxxxxxx9dd9",
         "name": "hwstaff_pub_CBUInfo_EI"
        },
        "id": "99250e439b33431081xxxxxxxxxxa885",
        "name": "xxxxxxxxxx"
       },
       "user_id": "99250e439b33431081xxxxxxxxxxa885",
       "volume": {
        "category": "EFS",
        "ownership": "MANAGED",
        "mount_path": "/home/ma-user/work/",
        "capacity": 50,
        "read_only": false
       },
       "workspace_id": "0",
       "billing_items": [
        "COMPUTE"
       ]
      }
  5. 调用Notebook时长续约接口重置Notebook实例的使用时长。
    1. 请求消息体:

      URI格式:PATCH https://{ma_endpoint}/v1/{project_id}notebooks/{id}/lease

      请求消息头:

      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      请求body:

      {
        "duration": 3600000,
        "type": "timing"
      }

      其中,加粗的字段需要根据实际值填写:

      • “duration”为实例运行时长,以创建时间为起点计算,即“创建时间+duration > 当前时刻”时,系统会自动停止实例。
      • “type”为自定停止类别,默认为timing。
    2. 返回状态码为“200”表示标注成功,响应Body如下所示:
      {
       "create_at": 1687656452470,
       "duration": 4657544,
       "enable": true,
       "type": "TIMING",
       "update_at": 1687657510014
      }
  6. 调用停止Notebook实例接口停止正在运行的实例。
    1. 消息请求体:

      URI格式:POSThttps://{ma_endpoint}//v1/{project_id}/notebooks/{id}/stop

      请求消息头:X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...

      其中,加粗的斜体字段需要根据实际值填写。

    2. 返回状态码为“200”,响应Body如下所示:
      {
       "create_at": 1687656452472,
       "data_volumes": [],
       "description": "api-test",
       "endpoints": [
        {
         "service": "NOTEBOOK",
         "uri": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab"
        }
       ],
       "feature": "NOTEBOOK",
       "flavor": "modelarts.vm.cpu.2u",
       "id": "936bea3e-d3df-435e-8b58-d817283284ae",
       "image": {
        "description": "",
        "id": "e1a07296-22a8-4f05-8bc8-e936c8e54090",
        "name": "notebook2.0-mul-kernel-cpu-cp36",
        "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-cpu-cp36:5.0.1-release-v2-20220505",
        "tag": "5.0.1-release-v2-20220505",
        "type": "BUILD_IN"
       },
       "lease": {
        "create_at": 1687656452470,
        "duration": 6199814,
        "enable": true,
        "type": "TIMING",
        "update_at": 1687659052284
       },
       "name": "notebooks_test",
       "status": "STOPPING",
       "tags": [],
       "token": "3452e0d5-15fe-a20d-18a2-010a574aeaaf",
       "update_at": 1687656479880,
       "url": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab",
       "user": {
        "domain": {
         "id": "878991804cdc4ba597xxxxxxxxxx9dd9",
         "name": "hwstaff_test"
        },
        "id": "99250e439b33431081xxxxxxxxxxa885",
        "name": "test"
       },
       "user_id": "99250e439b33431081xxxxxxxxxxa885",
       "volume": {
        "category": "EFS",
        "ownership": "MANAGED",
        "mount_path": "/home/ma-user/work/",
        "capacity": 50,
        "read_only": false
       },
       "workspace_id": "0",
       "billing_items": []
      }
  7. 调用启动Notebook实例接口重新启动实例。
    1. 消息请求体:

      URI格式:GET https://{ma_endpoint}/v1/{project_id}/notebooks/{id}/start

      请求消息头:X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...

      其中,加粗的斜体字段需要根据实际值填写。

    2. 返回状态码为“200”,响应Body如下所示:
      {
       "create_at": 1687656452472,
       "data_volumes": [],
       "description": "api-test",
       "endpoints": [
        {
         "service": "NOTEBOOK",
         "uri": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab"
        }
       ],
       "feature": "NOTEBOOK",
       "flavor": "modelarts.vm.cpu.2u",
       "id": "936bea3e-d3df-435e-8b58-d817283284ae",
       "image": {
        "description": "",
        "id": "e1a07296-22a8-4f05-8bc8-e936c8e54090",
        "name": "notebook2.0-mul-kernel-cpu-cp36",
        "swr_path": "swr.myhuaweicloud.com/atelier/notebook2.0-mul-kernel-cpu-cp36:5.0.1-release-v2-20220505",
        "tag": "5.0.1-release-v2-20220505",
        "type": "BUILD_IN"
       },
       "lease": {
        "create_at": 1687656452470,
        "duration": 6540099,
        "enable": true,
        "type": "TIMING",
        "update_at": 1687659392569
       },
       "name": "notebooks_test",
       "status": "STARTING",
       "tags": [],
       "token": "6f773860-21d4-9fe8-75c8-a38ea13ebf08",
       "update_at": 1687659203630,
       "url": "https://authoring-modelarts.huaweicloud.com/936bea3e-d3df-435e-8b58-d817283284ae/lab",
       "user": {
        "domain": {
         "id": "878991804cdc4ba597xxxxxxxxxx9dd9",
         "name": "hwstaff_test"
        },
        "id": "99250e439b33431081xxxxxxxxxxa885",
        "name": "test"
       },
       "user_id": "99250e439b33431081xxxxxxxxxxa885",
       "volume": {
        "category": "EFS",
        "ownership": "MANAGED",
        "mount_path": "/home/ma-user/work/",
        "capacity": 50,
        "read_only": false
       },
       "workspace_id": "0",
       "billing_items": []
      }
  8. 当Notebook实例不再需要时,调用删除Notebook实例接口删除实例。
    1. 请求消息体:

      URI格式:DELETE https://{ma_endpoint}/v1/{project_id}/notebooks/{id}

      请求消息头:

      • X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
      • Content-Type →application/json

      其中,加粗的斜体字段需要根据实际值填写。

    2. 返回状态码“200”表示实例删除成功。

我们使用cookie来确保您的高速浏览体验。继续浏览本站,即表示您同意我们使用cookie。 详情

文档反馈

文档反馈

意见反馈

0/500

标记内容

同时提交标记内容