huawei-cloud-modelarts-training-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Huawei Cloud ModelArts Training Management

华为云ModelArts训练管理

Full lifecycle management for ModelArts training jobs and related resources via hcloud CLI — 52 API interfaces across 8 functional domains.

通过hcloud CLI对ModelArts训练作业及相关资源进行全生命周期管理——覆盖8个功能域的52个API接口。

Overview

概述

This skill enables users to manage Huawei Cloud ModelArts training jobs and related resources through the
hcloud
CLI. It covers the complete training lifecycle including training job CRUD, algorithm management, training experiments, auto search (hyperparameter tuning), model import, and training image save.
本技能支持用户通过
hcloud
CLI管理华为云ModelArts训练作业及相关资源。它覆盖完整的训练生命周期,包括训练作业的增删改查(CRUD)、算法管理、训练实验、自动搜索(超参调优)、模型导入以及训练镜像保存。

Architecture

架构

User Request → Agent → hcloud ModelArts <Operation> --cli-region={region} [--params] → Huawei Cloud ModelArts API
User Request → Agent → hcloud ModelArts <Operation> --cli-region={region} [--params] → Huawei Cloud ModelArts API

Applicable Scenarios

适用场景

  • Training Job Management: Create, list, show, stop, delete training jobs; query logs, metrics, engines, flavors, quotas
  • Algorithm Management: Create, list, show, update, delete training algorithms; publish to gallery
  • Training Job Tags: Create, show, delete tags for training jobs
  • Training Experiments: Create, list, show, update, delete, check training experiments
  • Training Job Events: Query job events, stages, tasks; list system events and scheduled events
  • Model Import: Import, list, show, delete AI models; create ModelArts agency
  • Auto Search: Query hyperparameter search trials, parameters analysis, yaml templates
  • Training Image Save: Create and query training job image save tasks

  • 训练作业管理:创建、列出、查看、停止、删除训练作业;查询日志、指标、引擎、规格、配额
  • 算法管理:创建、列出、查看、更新、删除训练算法;发布至算法市场
  • 训练作业标签:创建、查看、删除训练作业标签
  • 训练实验:创建、列出、查看、更新、删除、检查训练实验
  • 训练作业事件:查询作业事件、阶段、任务;列出系统事件和定时事件
  • 模型导入:导入、列出、查看、删除AI模型;创建ModelArts委托
  • 自动搜索:查询超参搜索试验、参数分析、yaml模板
  • 训练镜像保存:创建和查询训练作业镜像保存任务

Prerequisites

前置条件

  1. hcloud CLI installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
  2. Huawei Cloud AK/SK configured via hcloud or environment variables
  3. ModelArts service enabled in the target region
  4. IAM permissions — See references/iam-policies.md

  1. 已安装并认证hcloud CLI — 参考文档:https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
  2. 已通过hcloud或环境变量配置华为云AK/SK
  3. 已在目标区域启用ModelArts服务
  4. 具备IAM权限 — 详见references/iam-policies.md

Workflow

工作流程

Step 1: Identify the Operation

步骤1:确定操作类型

Determine which training operation the user needs based on their request:
User IntentOperation Category
Create/list/show/stop/delete training jobsTraining Job Management
Create/list/show/update/delete algorithmsAlgorithm Management
Create/show/delete training job tagsTraining Job Tags
Create/list/show/update/delete experimentsTraining Experiments
Query job events, stages, tasksTraining Job Events
Import/list/show/delete modelsModel Import
Query auto search trials, params analysisAuto Search
Save training job imageTraining Image Save
根据用户请求确定所需的训练操作:
用户意图操作分类
创建/列出/查看/停止/删除训练作业训练作业管理
创建/列出/查看/更新/删除算法算法管理
创建/查看/删除训练作业标签训练作业标签
创建/列出/查看/更新/删除实验训练实验
查询作业事件、阶段、任务训练作业事件
导入/列出/查看/删除模型模型导入
查询自动搜索试验、参数分析自动搜索
保存训练作业镜像训练镜像保存

Step 2: Execute CLI Command

步骤2:执行CLI命令

bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
{region}
must be replaced with the actual region, e.g.,
cn-north-4
. Do NOT hardcode the region.
bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
{region}
必须替换为实际区域,例如
cn-north-4
,请勿硬编码区域。

Step 3: Handle Write Operations

步骤3:处理写入操作

For all write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept/Batch), prompt the user for confirmation before execution.

对于所有写入操作(创建/更新/删除/停止/变更/补丁/通知/接受/批量操作),执行前需提示用户确认

KooCLI Command Format Standard

KooCLI命令格式规范

bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
FeatureDescriptionExample
Service nameFixed:
ModelArts
ModelArts
Operation namePascalCase
ListTrainingJobs
,
CreateTrainingJob
Region parameter
--cli-region={region}
--cli-region=cn-north-4
Simple parameter
--key=value
--training_job_id=xxx
Indexed parameter
--key.1=value1
--config.1.name=cfg1
project_idAuto-resolved if omittedUses configured project ID
Note:
--project_id
is auto-resolved from authentication credentials if omitted. Include it explicitly only when targeting a specific project.
Complex parameters: For complex nested parameters (e.g.,
config
,
spec
), use
--cli-jsonInput=/path/to/file.json
. The JSON file must wrap body in
{"body": {...}}
envelope.

bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
特性描述示例
服务名称固定为
ModelArts
ModelArts
操作名称采用大驼峰命名(PascalCase)
ListTrainingJobs
,
CreateTrainingJob
区域参数
--cli-region={region}
--cli-region=cn-north-4
简单参数
--key=value
--training_job_id=xxx
索引参数
--key.1=value1
--config.1.name=cfg1
project_id若省略则自动解析使用已配置的项目ID
注意:若省略
--project_id
,将从认证凭证中自动解析。仅在指定特定项目时需显式添加。
复杂参数:对于复杂嵌套参数(例如
config
spec
),使用
--cli-jsonInput=/path/to/file.json
。JSON文件必须将请求体包裹在
{"body": {...}}
结构中。

Core Commands

核心命令

All 52 CLI command examples across 8 functional domains are documented in a separate reference file.
📖 For detailed command syntax, parameters, and examples, read references/cli-command-examples.md
8个功能域的全部52个CLI命令示例均记录在单独的参考文件中。
📖 如需详细命令语法、参数及示例,请阅读references/cli-command-examples.md

Quick Index

快速索引

#DomainAPIsKey Operations
1Training Job Management14CreateTrainingJob, ListTrainingJobs, ShowTrainingJobDetails, StopTrainingJob, DeleteTrainingJob, ShowTrainingJobLogs/Metrics/Engines/Flavors/Quotas
2Algorithm Management7CreateAlgorithm, ListAlgorithms, ShowAlgorithmByUuid, ChangeAlgorithm, DeleteAlgorithm, ShowSearchAlgorithms, CreateAlgorithmVersionToGallery
3Training Job Tags3CreateTrainJobTags, ShowTrainJobTags, DeleteTrainJobTags
4Training Experiments6CreateTrainingExperiment, List/Show/Delete/Change/Check experiments
5Training Job Events7ListTrainingJobEvents/Stages/Tasks, ListEvents/Categories/ScheduledEvents, AcceptScheduledEvent
6Model Import6CreateModel, ListModels, ShowModel, DeleteModel, ShowModelEngineAndRuntime, CreateModelArtsAgency
7Auto Search7ShowAutoSearchTrials/PerTrial/ParamsAnalysis/YamlTemplates, ShowAutoSearchTrialEarlyStop
8Training Image Save2CreateSaveImageJob, ShowSaveImageJob
When executing any command, always refer to the reference file for exact parameter names, required/optional flags, and usage patterns.

序号功能域API数量核心操作
1训练作业管理14CreateTrainingJob、ListTrainingJobs、ShowTrainingJobDetails、StopTrainingJob、DeleteTrainingJob、ShowTrainingJobLogs/Metrics/Engines/Flavors/Quotas
2算法管理7CreateAlgorithm、ListAlgorithms、ShowAlgorithmByUuid、ChangeAlgorithm、DeleteAlgorithm、ShowSearchAlgorithms、CreateAlgorithmVersionToGallery
3训练作业标签3CreateTrainJobTags、ShowTrainJobTags、DeleteTrainJobTags
4训练实验6CreateTrainingExperiment、列出/查看/删除/变更/检查实验
5训练作业事件7ListTrainingJobEvents/Stages/Tasks、ListEvents/Categories/ScheduledEvents、AcceptScheduledEvent
6模型导入6CreateModel、ListModels、ShowModel、DeleteModel、ShowModelEngineAndRuntime、CreateModelArtsAgency
7自动搜索7ShowAutoSearchTrials/PerTrial/ParamsAnalysis/YamlTemplates、ShowAutoSearchTrialEarlyStop
8训练镜像保存2CreateSaveImageJob、ShowSaveImageJob
执行任何命令时,请务必参考参考文件获取准确的参数名称、必填/可选标识及使用方式。

Parameter Confirmation

参数确认

ParameterRequiredDescriptionExample
{region}
YesHuawei Cloud region
cn-north-4
,
cn-east-3
{training_job_id}
Job opsTraining job UUID
xxx-xxx-xxx
{algorithm_id}
Algorithm opsAlgorithm UUID
xxx-xxx-xxx
{experiment_id}
Experiment opsTraining experiment UUID
xxx-xxx-xxx
{model_id}
Model opsModel UUID
xxx-xxx-xxx
{job_id}
SaveImage opsSave image job UUID
xxx-xxx-xxx
{project_id}
No (auto)Project ID, auto-resolved if omittedOmit for default
{workspace_id}
NoWorkspace IDOmit for default workspace

参数是否必填描述示例
{region}
华为云区域
cn-north-4
,
cn-east-3
{training_job_id}
作业操作时需填训练作业UUID
xxx-xxx-xxx
{algorithm_id}
算法操作时需填算法UUID
xxx-xxx-xxx
{experiment_id}
实验操作时需填训练实验UUID
xxx-xxx-xxx
{model_id}
模型操作时需填模型UUID
xxx-xxx-xxx
{job_id}
镜像保存操作时需填镜像保存作业UUID
xxx-xxx-xxx
{project_id}
否(自动解析)项目ID,省略时自动解析使用默认值可省略
{workspace_id}
工作空间ID使用默认工作空间可省略

SDK Fallback

SDK降级方案

If a CLI operation fails due to a CLI bug, fall back to SDK:
python
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkmodelarts.v2.modelarts_client import ModelArtsClient
from huaweicloudsdkmodelarts.v2.region.modelarts_region import ModelArtsRegion

credentials = BasicCredentials(ak="{AK}", sk="{SK}", project_id="{project_id}")
client = ModelArtsClient.new_builder() \
    .with_credentials(credentials) \
    .with_region(ModelArtsRegion.value_of("{region}")) \
    .build()

若因CLI bug导致操作失败,可降级使用SDK:
python
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkmodelarts.v2.modelarts_client import ModelArtsClient
from huaweicloudsdkmodelarts.v2.region.modelarts_region import ModelArtsRegion

credentials = BasicCredentials(ak="{AK}", sk="{SK}", project_id="{project_id}")
client = ModelArtsClient.new_builder() \
    .with_credentials(credentials) \
    .with_region(ModelArtsRegion.value_of("{region}")) \
    .build()

Reference Documents

参考文档

DocumentDescription
references/cli-command-examples.mdDetailed CLI command syntax and examples for all 52 APIs
references/iam-policies.mdLeast-privilege IAM policies
references/verification-method.mdVerification and testing methods
references/dataflow-diagram.mdMermaid data flow diagram
references/acceptance-criteria.mdAcceptance criteria checklist
references/api-paths.mdREST API paths from SDK source
references/cli-installation-guide.mdCLI installation and authentication guide
references/known-issues.mdKnown issues and workarounds

文档描述
references/cli-command-examples.md所有52个API的详细CLI命令语法及示例
references/iam-policies.md最小权限IAM策略
references/verification-method.md验证与测试方法
references/dataflow-diagram.mdMermaid数据流图
references/acceptance-criteria.md验收标准清单
references/api-paths.mdSDK源码中的REST API路径
references/cli-installation-guide.mdCLI安装与认证指南
references/known-issues.md已知问题及解决方案

Known Issues Summary

已知问题汇总

  • Complex nested params: Use
    --cli-jsonInput
    with JSON file for CreateTrainingJob, CreateAlgorithm, CreateModel, etc.
  • --cli-jsonInput
    syntax
    : Use file path directly (no
    @
    prefix), JSON must be wrapped in
    {"body": {...}}
  • Training job logs:
    ShowObsUrlOfTrainingJobLogs
    returns a temporary OBS URL (valid for 5 minutes)
  • StopTrainingJob: Can only stop jobs in
    creating
    ,
    waiting
    , or
    running
    state
  • Auto search: Trial early stop only works on running trials
See references/known-issues.md for full details.

  • 复杂嵌套参数:创建训练作业、创建算法、创建模型等操作需使用
    --cli-jsonInput
    配合JSON文件
  • --cli-jsonInput
    语法
    :直接使用文件路径(无需
    @
    前缀),JSON必须包裹在
    {"body": {...}}
    结构中
  • 训练作业日志
    ShowObsUrlOfTrainingJobLogs
    返回临时OBS URL(有效期5分钟)
  • StopTrainingJob:仅能停止处于
    creating
    waiting
    running
    状态的作业
  • 自动搜索:试验提前停止仅对运行中的试验生效
详见references/known-issues.md获取完整信息。

Notes

注意事项

  • All write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept) require user confirmation before execution
  • Region is not hardcoded — uses
    {region}
    placeholder
  • project_id
    is auto-resolved when omitted
  • No hardcoded AK/SK in any file — credentials read from environment variables
  • SDK fallback available when CLI encounters bugs
  • Complex nested parameters use
    --cli-jsonInput
    with JSON file
  • 所有写入操作(创建/更新/删除/停止/变更/补丁/通知/接受)执行前需用户确认
  • 区域未硬编码——使用
    {region}
    占位符
  • 省略
    project_id
    时将自动解析
  • 所有文件中无硬编码的AK/SK——凭证从环境变量读取
  • 当CLI遇到bug时可使用SDK降级方案
  • 复杂嵌套参数需使用
    --cli-jsonInput
    配合JSON文件