huawei-cloud-modelarts-training-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHuawei 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 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)、算法管理、训练实验、自动搜索(超参调优)、模型导入以及训练镜像保存。
hcloudArchitecture
架构
User Request → Agent → hcloud ModelArts <Operation> --cli-region={region} [--params] → Huawei Cloud ModelArts APIUser Request → Agent → hcloud ModelArts <Operation> --cli-region={region} [--params] → Huawei Cloud ModelArts APIApplicable 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
前置条件
- hcloud CLI installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
- Huawei Cloud AK/SK configured via hcloud or environment variables
- ModelArts service enabled in the target region
- IAM permissions — See references/iam-policies.md
- 已安装并认证hcloud CLI — 参考文档:https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
- 已通过hcloud或环境变量配置华为云AK/SK
- 已在目标区域启用ModelArts服务
- 具备IAM权限 — 详见references/iam-policies.md
Workflow
工作流程
Step 1: Identify the Operation
步骤1:确定操作类型
Determine which training operation the user needs based on their request:
| User Intent | Operation Category |
|---|---|
| Create/list/show/stop/delete training jobs | Training Job Management |
| Create/list/show/update/delete algorithms | Algorithm Management |
| Create/show/delete training job tags | Training Job Tags |
| Create/list/show/update/delete experiments | Training Experiments |
| Query job events, stages, tasks | Training Job Events |
| Import/list/show/delete models | Model Import |
| Query auto search trials, params analysis | Auto Search |
| Save training job image | Training Image Save |
根据用户请求确定所需的训练操作:
| 用户意图 | 操作分类 |
|---|---|
| 创建/列出/查看/停止/删除训练作业 | 训练作业管理 |
| 创建/列出/查看/更新/删除算法 | 算法管理 |
| 创建/查看/删除训练作业标签 | 训练作业标签 |
| 创建/列出/查看/更新/删除实验 | 训练实验 |
| 查询作业事件、阶段、任务 | 训练作业事件 |
| 导入/列出/查看/删除模型 | 模型导入 |
| 查询自动搜索试验、参数分析 | 自动搜索 |
| 保存训练作业镜像 | 训练镜像保存 |
Step 2: Execute CLI Command
步骤2:执行CLI命令
bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]must be replaced with the actual region, e.g.,{region}. Do NOT hardcode the region.cn-north-4
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 ...]| Feature | Description | Example |
|---|---|---|
| Service name | Fixed: | |
| Operation name | PascalCase | |
| Region parameter | | |
| Simple parameter | | |
| Indexed parameter | | |
| project_id | Auto-resolved if omitted | Uses configured project ID |
Note:is auto-resolved from authentication credentials if omitted. Include it explicitly only when targeting a specific project.--project_id
Complex parameters: For complex nested parameters (e.g.,,config), usespec. The JSON file must wrap body in--cli-jsonInput=/path/to/file.jsonenvelope.{"body": {...}}
bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]| 特性 | 描述 | 示例 |
|---|---|---|
| 服务名称 | 固定为 | |
| 操作名称 | 采用大驼峰命名(PascalCase) | |
| 区域参数 | | |
| 简单参数 | | |
| 索引参数 | | |
| project_id | 若省略则自动解析 | 使用已配置的项目ID |
注意:若省略,将从认证凭证中自动解析。仅在指定特定项目时需显式添加。--project_id
复杂参数:对于复杂嵌套参数(例如、config),使用spec。JSON文件必须将请求体包裹在--cli-jsonInput=/path/to/file.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
快速索引
| # | Domain | APIs | Key Operations |
|---|---|---|---|
| 1 | Training Job Management | 14 | CreateTrainingJob, ListTrainingJobs, ShowTrainingJobDetails, StopTrainingJob, DeleteTrainingJob, ShowTrainingJobLogs/Metrics/Engines/Flavors/Quotas |
| 2 | Algorithm Management | 7 | CreateAlgorithm, ListAlgorithms, ShowAlgorithmByUuid, ChangeAlgorithm, DeleteAlgorithm, ShowSearchAlgorithms, CreateAlgorithmVersionToGallery |
| 3 | Training Job Tags | 3 | CreateTrainJobTags, ShowTrainJobTags, DeleteTrainJobTags |
| 4 | Training Experiments | 6 | CreateTrainingExperiment, List/Show/Delete/Change/Check experiments |
| 5 | Training Job Events | 7 | ListTrainingJobEvents/Stages/Tasks, ListEvents/Categories/ScheduledEvents, AcceptScheduledEvent |
| 6 | Model Import | 6 | CreateModel, ListModels, ShowModel, DeleteModel, ShowModelEngineAndRuntime, CreateModelArtsAgency |
| 7 | Auto Search | 7 | ShowAutoSearchTrials/PerTrial/ParamsAnalysis/YamlTemplates, ShowAutoSearchTrialEarlyStop |
| 8 | Training Image Save | 2 | CreateSaveImageJob, ShowSaveImageJob |
When executing any command, always refer to the reference file for exact parameter names, required/optional flags, and usage patterns.
| 序号 | 功能域 | API数量 | 核心操作 |
|---|---|---|---|
| 1 | 训练作业管理 | 14 | CreateTrainingJob、ListTrainingJobs、ShowTrainingJobDetails、StopTrainingJob、DeleteTrainingJob、ShowTrainingJobLogs/Metrics/Engines/Flavors/Quotas |
| 2 | 算法管理 | 7 | CreateAlgorithm、ListAlgorithms、ShowAlgorithmByUuid、ChangeAlgorithm、DeleteAlgorithm、ShowSearchAlgorithms、CreateAlgorithmVersionToGallery |
| 3 | 训练作业标签 | 3 | CreateTrainJobTags、ShowTrainJobTags、DeleteTrainJobTags |
| 4 | 训练实验 | 6 | CreateTrainingExperiment、列出/查看/删除/变更/检查实验 |
| 5 | 训练作业事件 | 7 | ListTrainingJobEvents/Stages/Tasks、ListEvents/Categories/ScheduledEvents、AcceptScheduledEvent |
| 6 | 模型导入 | 6 | CreateModel、ListModels、ShowModel、DeleteModel、ShowModelEngineAndRuntime、CreateModelArtsAgency |
| 7 | 自动搜索 | 7 | ShowAutoSearchTrials/PerTrial/ParamsAnalysis/YamlTemplates、ShowAutoSearchTrialEarlyStop |
| 8 | 训练镜像保存 | 2 | CreateSaveImageJob、ShowSaveImageJob |
执行任何命令时,请务必参考参考文件获取准确的参数名称、必填/可选标识及使用方式。
Parameter Confirmation
参数确认
| Parameter | Required | Description | Example |
|---|---|---|---|
| Yes | Huawei Cloud region | |
| Job ops | Training job UUID | |
| Algorithm ops | Algorithm UUID | |
| Experiment ops | Training experiment UUID | |
| Model ops | Model UUID | |
| SaveImage ops | Save image job UUID | |
| No (auto) | Project ID, auto-resolved if omitted | Omit for default |
| No | Workspace ID | Omit for default workspace |
| 参数 | 是否必填 | 描述 | 示例 |
|---|---|---|---|
| 是 | 华为云区域 | |
| 作业操作时需填 | 训练作业UUID | |
| 算法操作时需填 | 算法UUID | |
| 实验操作时需填 | 训练实验UUID | |
| 模型操作时需填 | 模型UUID | |
| 镜像保存操作时需填 | 镜像保存作业UUID | |
| 否(自动解析) | 项目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
参考文档
| Document | Description |
|---|---|
| references/cli-command-examples.md | Detailed CLI command syntax and examples for all 52 APIs |
| references/iam-policies.md | Least-privilege IAM policies |
| references/verification-method.md | Verification and testing methods |
| references/dataflow-diagram.md | Mermaid data flow diagram |
| references/acceptance-criteria.md | Acceptance criteria checklist |
| references/api-paths.md | REST API paths from SDK source |
| references/cli-installation-guide.md | CLI installation and authentication guide |
| references/known-issues.md | Known issues and workarounds |
| 文档 | 描述 |
|---|---|
| references/cli-command-examples.md | 所有52个API的详细CLI命令语法及示例 |
| references/iam-policies.md | 最小权限IAM策略 |
| references/verification-method.md | 验证与测试方法 |
| references/dataflow-diagram.md | Mermaid数据流图 |
| references/acceptance-criteria.md | 验收标准清单 |
| references/api-paths.md | SDK源码中的REST API路径 |
| references/cli-installation-guide.md | CLI安装与认证指南 |
| references/known-issues.md | 已知问题及解决方案 |
Known Issues Summary
已知问题汇总
- Complex nested params: Use with JSON file for CreateTrainingJob, CreateAlgorithm, CreateModel, etc.
--cli-jsonInput - syntax: Use file path directly (no
--cli-jsonInputprefix), JSON must be wrapped in@{"body": {...}} - Training job logs: returns a temporary OBS URL (valid for 5 minutes)
ShowObsUrlOfTrainingJobLogs - StopTrainingJob: Can only stop jobs in ,
creating, orwaitingstaterunning - Auto search: Trial early stop only works on running trials
See references/known-issues.md for full details.
- 复杂嵌套参数:创建训练作业、创建算法、创建模型等操作需使用配合JSON文件
--cli-jsonInput - 语法:直接使用文件路径(无需
--cli-jsonInput前缀),JSON必须包裹在@结构中{"body": {...}} - 训练作业日志:返回临时OBS URL(有效期5分钟)
ShowObsUrlOfTrainingJobLogs - 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 placeholder
{region} - is auto-resolved when omitted
project_id - No hardcoded AK/SK in any file — credentials read from environment variables
- SDK fallback available when CLI encounters bugs
- Complex nested parameters use with JSON file
--cli-jsonInput
- 所有写入操作(创建/更新/删除/停止/变更/补丁/通知/接受)执行前需用户确认
- 区域未硬编码——使用占位符
{region} - 省略时将自动解析
project_id - 所有文件中无硬编码的AK/SK——凭证从环境变量读取
- 当CLI遇到bug时可使用SDK降级方案
- 复杂嵌套参数需使用配合JSON文件
--cli-jsonInput