Huawei Cloud ModelArts Training Management
Full lifecycle management for ModelArts training jobs and related resources via hcloud CLI — 52 API interfaces across 8 functional domains.
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.
Architecture
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
Prerequisites
- hcloud CLI installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
- Huawei Cloud AK/SK configured via hcloud (see Security & Credential Check below)
- ModelArts service enabled in the target region
- IAM permissions — See references/iam-policies.md
Security & Credential Check
⚠️ CRITICAL: This section defines the agent's security boundary. Follow it strictly.
🔒 Security Rules (MANDATORY)
- 🚫 NEVER read, echo, or print AK/SK values (e.g.,
cat ~/.hcloud/config.json, echo $HW_ACCESS_KEY is FORBIDDEN)
- 🚫 NEVER read or cat credential files such as
~/.hcloud/config.json or any file that may contain secrets
- 🚫 NEVER ask the user to input AK/SK directly in the conversation or command line
- 🚫 NEVER execute
hcloud configure set --cli-access-key=... --cli-secret-key=... — credential configuration is the user's responsibility, done outside the agent session
- 🚫 NEVER pass
--cli-access-key/--cli-secret-key on every API call — they will be exposed in process listings (ps aux) for the entire request duration
- ✅ ALWAYS use
hcloud configure list to check credential status (presence check only, not values)
- ✅ If no valid profile exists, STOP and instruct the user to configure credentials outside this session
- ✅ Recommend using IAM user with minimal permissions instead of main account
✅ Agent Credential Check (the ONLY acceptable check)
# Step 1: Check credential status — presence only, not values
hcloud configure list
✅ Expected: Shows a valid profile with mode: AKSK
❌ If empty/invalid → Guide the user with the 3-step process below:
Step-by-step guidance (copy-paste for the user):
"No valid credentials found. Please follow these 3 steps in your terminal:"
① Get your AK/SK
Log in to Huawei Cloud Console → IAM → Access Keys. If you don't have one, click "Create Access Key" and save it securely.
② Run this in your terminal (one-time setup):
hcloud configure set --cli-access-key=<YOUR_AK> --cli-secret-key=<YOUR_SK>
(Replace <YOUR_AK> and <YOUR_SK> with the values from step ①)
③ Come back and tell me "configured", I'll verify it works.
Note: The configure set command stores your credentials in ~/.hcloud/config.json. After that, all hcloud commands use them automatically — no need to pass AK/SK again.
Agent: DO NOT execute any configure set command yourself.
🔧 User's Responsibility (for documentation, NOT agent execution)
The user configures credentials outside the agent session (in their own terminal):
# One-time setup — run this in your terminal, NOT in the agent chat
HISTCONTROL=ignorespace
hcloud configure set --cli-access-key=<YOUR_AK> --cli-secret-key=<YOUR_SK>
⚠️ Note: hcloud CLI does NOT read HW_ACCESS_KEY/HW_SECRET_KEY environment variables (those are for Python SDK only). hcloud configure set is the only supported credential configuration method.
Workflow
Step 1: Identify the Operation
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
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.
Step 2.5: ⚠️ Pre-Flight Check (MANDATORY for Write Operations)
Before executing ANY write operation (Create/Update/Delete/Stop/Change/Patch/Notify/Accept), you MUST:
- Read references/known-issues.md — Scan the relevant section for the target API
- Apply documented workarounds — Especially for the following high-risk operations:
| Operation |
Critical Issue |
Action Required |
| CreateTrainingJob |
Must use v2 kind/metadata/spec/tasks format |
Use --cli-jsonInput with v2 JSON structure |
| CreateTrainingJob (dedicated pool) |
flavor_id not accepted for dedicated pools |
Omit flavor_id, specify pool_id instead |
| CreateAlgorithm |
JSON must use nested metadata + job_config structure |
Use --cli-jsonInput with correct nesting (see known-issues #27) |
| CreateAlgorithm |
OBS code directory must exist and be accessible |
Verify OBS path before calling API |
| StopTrainingJob |
Can only stop jobs in creating/waiting/running state |
Check job status first |
| CreateModel |
source_location format must be obs://bucket/path/ |
Verify OBS path format |
| CreateModel |
model_type must be a valid value |
Check known-issues #22 for valid values |
| CreateSaveImageJob |
Requires job in running state; SWR namespace required |
Verify job status and SWR config |
| ChangeAlgorithm |
Must include --metadata.name parameter |
Add metadata.name to request |
| NotifyTrainingJobInformation |
Parameter names differ from API docs |
Check known-issues #24 |
| UpdateTrainingJob |
Not a valid CLI operation |
Use ChangeTrainingJob instead |
Skipping this step will cause preventable failures. Every issue in the table was discovered through real API testing.
Step 3: Pricing Inquiry (for chargeable operations)
Before executing chargeable write operations (CreateTrainingJob on public resource pool, CreateTrainingExperiment), perform a BSS pricing inquiry to show estimated costs to the user.
📖 For detailed pricing inquiry procedures, read references/pricing-inquiry.md
Chargeable Operations
| Operation |
Needs Inquiry |
Condition |
| CreateTrainingJob |
✅ Yes |
When using public resource pool (no pool_id specified) |
| CreateTrainingJob |
❌ No |
When using dedicated resource pool (pool_id specified — pool already billed) |
| CreateTrainingExperiment |
✅ Yes |
Experiments may launch training jobs with compute costs |
| All other operations |
❌ No |
Read operations, deletes, stops, tags, etc. do not incur charges |
Inquiry Workflow
1. Detect chargeable operation (CreateTrainingJob without pool_id)
2. Extract flavor_id from spec.resource.flavor_id parameter
3. Get project ID via IAM KeystoneListAuthProjects
4. Call BSS ListOnDemandResourceRatings to query on-demand price
5. Calculate estimated cost: unit_price × node_count × estimated_duration
6. Display price table and cost estimate to user
7. Proceed to Step 4 (user confirmation) after showing pricing info
Quick Pricing Query
Use the helper script for quick price queries:
# Query single flavor
bash scripts/query-pricing.sh --region cn-north-4 --flavor modelarts.bm.gpu.v100
# Query multiple flavors for comparison
bash scripts/query-pricing.sh --region cn-north-4 --flavor modelarts.bm.gpu.v100 --flavor modelarts.cpu.8u32g --flavor modelarts.bm.ascend910
BSS Inquiry Parameters (Fixed)
| Parameter |
Value |
Description |
cloud_service_type |
hws.service.type.modelarts |
ModelArts service type |
resource_type |
hws.resource.type.modelarts |
ModelArts resource type |
usage_measure_id |
4 |
Hour (billing unit) |
size_measure_id |
14 |
Instance count |
| BSS API region |
cn-north-1 |
BSS API always uses cn-north-1 |
Step 4: Handle Write Operations
For all write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept/Batch), prompt the user for confirmation before execution. For chargeable operations, confirmation includes reviewing the pricing information from Step 3.
Step 5: Generate Console URL (after CreateTrainingJob)
After successfully creating a training job, generate and display the ModelArts console URL so the user can directly access the job details in the web console.
URL Format
Training job detail page (after CreateTrainingJob):
https://console.huaweicloud.com/modelarts/?region={region}#/training/detail/{job_id}
Training job list page (after ListTrainingJobs):
https://console.huaweicloud.com/modelarts/?region={region}#/training
| Component |
Description |
Example |
{region} |
The region where the job was created |
cn-north-4 |
{job_id} |
Training job ID returned by CreateTrainingJob |
39cefbeb-0d86-46cb-a55a-fe6a62f3529b |
Important: Use #/training/detail/{job_id} for detail and #/training for list (new console paths). Do NOT use #/trainingJobs/details/{job_id} or #/trainingJobs — those are deprecated old console paths.
Workflow
1. CreateTrainingJob returns job_id in the response
2. Construct console URL: https://console.huaweicloud.com/modelarts/?region={region}#/training/detail/{job_id}
3. Display the URL to the user with a summary of the created job
Example Output
✅ Training job created successfully!
Job Name: my-training-job
Job ID: 39cefbeb-0d86-46cb-a55a-fe6a62f3529b
Status: creating
Region: cn-north-4
🔗 Console URL:
https://console.huaweicloud.com/modelarts/?region=cn-north-4#/training/detail/39cefbeb-0d86-46cb-a55a-fe6a62f3529b
Note: The console URL uses hash routing (#/training/detail/{job_id}). Do NOT use the old path #/trainingJobs/details/{job_id} — it redirects to a deprecated console page. The URL is valid as long as the training job exists and the user has ModelArts access permissions for the region.
KooCLI Command Format Standard
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
| Feature |
Description |
Example |
| Service name |
Fixed: ModelArts |
ModelArts |
| Operation name |
PascalCase |
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 |
--tasks.1.role=worker |
| project_id |
Auto-resolved if omitted |
Uses 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.
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
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.
Capability Boundary(能力边界)
This skill covers only ModelArts training management — 52 APIs across 8 functional domains (see Core Commands above). The following ModelArts capabilities are NOT supported:
| Unsupported Domain |
Example Operations |
Suggestion |
| Notebook (Dev Environment) |
CreateNotebook, ListNotebooks, ShowNotebook |
Use ModelArts console or dedicated notebook skill |
| Inference Service (Online Service) |
CreateService, ListServices, ShowService |
Use ModelArts console or inference skill |
| Resource Pool / Cluster |
CreateResourcePool, ListResourcePools |
Use ModelArts console |
| Workflow Orchestration |
CreateWorkflow, ListWorkflows |
Use ModelArts console |
| Image Management (SWR) |
ListImages, ShowImage |
Use SWR console or CLI directly |
| DevServer |
CreateDevServer, ListDevServers |
Use ModelArts console |
| Workspace Management |
CreateWorkspace, ListWorkspaces |
Use ModelArts console |
When receiving requests for the above unsupported capabilities, explicitly inform the user that this skill does not support them, and suggest using the ModelArts console (https://console.huaweicloud.com/modelarts/) or the relevant dedicated skill.
Parameter Confirmation
| Parameter |
Required |
Description |
Example |
{region} |
Yes |
Huawei Cloud region |
cn-north-4, cn-east-3 |
{training_job_id} |
Job ops |
Training job UUID |
xxx-xxx-xxx |
{algorithm_id} |
Algorithm ops |
Algorithm UUID |
xxx-xxx-xxx |
{experiment_id} |
Experiment ops |
Training experiment UUID |
xxx-xxx-xxx |
{model_id} |
Model ops |
Model UUID |
xxx-xxx-xxx |
{job_id} |
SaveImage ops |
Save image job UUID |
xxx-xxx-xxx |
{project_id} |
No (auto) |
Project ID, auto-resolved if omitted |
Omit for default |
{workspace_id} |
No |
Workspace ID |
Omit for default workspace |
SDK Fallback
If a CLI operation fails due to a CLI bug, fall back to SDK:
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/pricing-inquiry.md |
BSS on-demand pricing inquiry for training jobs (pre-creation cost estimation) |
| 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 |
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.
Notes
- All write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept) require user confirmation before execution
- Pricing inquiry: CreateTrainingJob (public pool) and CreateTrainingExperiment trigger BSS pricing inquiry before execution — see references/pricing-inquiry.md
- Dedicated resource pool: Training jobs using a dedicated resource pool (
pool_id specified) do NOT require pricing inquiry — the pool is already billed
- Region is not hardcoded — uses
{region} placeholder
project_id is auto-resolved when omitted
- No hardcoded AK/SK in any file — credentials configured via
hcloud configure set by the user outside the agent session
- Agent must use
hcloud configure list for credential presence check only — NEVER read/echo AK/SK values
- If no valid credentials found, agent must STOP and guide user through the 3-step configuration process (see Prerequisites section)
- SDK fallback available when CLI encounters bugs
- Complex nested parameters use
--cli-jsonInput with JSON file
1---2name: huawei-cloud-modelarts-training-management3description: Manage Huawei Cloud ModelArts training jobs and related resources through full lifecycle operations via hcloud CLI. Covers 52 API interfaces across 8 functional domains: training job management, algorithm management, training job tags, training experiments, training job events, model import, auto search (hyperparameter tuning), and training image save. All write operations require user confirmation before execution. Triggers include: "ModelArts training", "训练作业", "模型训练", "创建训练作业", "查询训练作业", "停止训练作业", "删除训练作业", "算法管理", "超参配置", "training job", "training management", "create training", "ModelArts 训练", "训练实验", "自动搜索", "超参调优".4---5
6# Huawei Cloud ModelArts Training Management
7
8> Full lifecycle management for ModelArts training jobs and related resources via hcloud CLI — 52 API interfaces across 8 functional domains.
9
10---
11
12## Overview
13
14This 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.
15
16### Architecture
17
18```
19User Request → Agent → hcloud ModelArts <Operation> --cli-region={region} [--params] → Huawei Cloud ModelArts API
20```
21
22### Applicable Scenarios
23
24- **Training Job Management**: Create, list, show, stop, delete training jobs; query logs, metrics, engines, flavors, quotas
25- **Algorithm Management**: Create, list, show, update, delete training algorithms; publish to gallery
26- **Training Job Tags**: Create, show, delete tags for training jobs
27- **Training Experiments**: Create, list, show, update, delete, check training experiments
28- **Training Job Events**: Query job events, stages, tasks; list system events and scheduled events
29- **Model Import**: Import, list, show, delete AI models; create ModelArts agency
30- **Auto Search**: Query hyperparameter search trials, parameters analysis, yaml templates
31- **Training Image Save**: Create and query training job image save tasks
32
33---
34
35## Prerequisites
36
371. **hcloud CLI** installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
382. **Huawei Cloud AK/SK** configured via hcloud (see Security & Credential Check below)
393. **ModelArts service** enabled in the target region
404. **IAM permissions** — See [references/iam-policies.md](references/iam-policies.md)
41
42### Security & Credential Check
43
44> **⚠️ CRITICAL: This section defines the agent's security boundary. Follow it strictly.**
45
46#### 🔒 Security Rules (MANDATORY)
47
48- 🚫 **NEVER** read, echo, or print AK/SK values (e.g., `cat ~/.hcloud/config.json`, `echo $HW_ACCESS_KEY` is FORBIDDEN)
49- 🚫 **NEVER** read or cat credential files such as `~/.hcloud/config.json` or any file that may contain secrets
50- 🚫 **NEVER** ask the user to input AK/SK directly in the conversation or command line
51- 🚫 **NEVER** execute `hcloud configure set --cli-access-key=... --cli-secret-key=...` — credential configuration is the **user's responsibility**, done outside the agent session
52- 🚫 **NEVER** pass `--cli-access-key`/`--cli-secret-key` on **every API call** — they will be exposed in process listings (`ps aux`) for the entire request duration
53- ✅ **ALWAYS** use `hcloud configure list` to check credential status (presence check only, not values)
54- ✅ If no valid profile exists, **STOP** and instruct the user to configure credentials outside this session
55- ✅ **Recommend** using IAM user with minimal permissions instead of main account
56
57#### ✅ Agent Credential Check (the ONLY acceptable check)
58
59```bash
60# Step 1: Check credential status — presence only, not values
61hcloud configure list
62```
63
64- ✅ **Expected**: Shows a valid profile with `mode: AKSK`
65- ❌ **If empty/invalid** → Guide the user with the 3-step process below:
66
67 **Step-by-step guidance (copy-paste for the user):**
68
69 > *"No valid credentials found. Please follow these 3 steps in your terminal:"*
70 >
71 > **① Get your AK/SK**
72 > Log in to [Huawei Cloud Console](https://console.huaweicloud.com) → IAM → Access Keys. If you don't have one, click "Create Access Key" and save it securely.
73 >
74 > **② Run this in your terminal (one-time setup):**
75 > ```bash
76 > hcloud configure set --cli-access-key=<YOUR_AK> --cli-secret-key=<YOUR_SK>
77 > ```
78 > *(Replace `<YOUR_AK>` and `<YOUR_SK>` with the values from step ①)*
79 >
80 > **③ Come back and tell me "configured"**, I'll verify it works.
81 >
82 > *Note: The `configure set` command stores your credentials in `~/.hcloud/config.json`. After that, all hcloud commands use them automatically — no need to pass AK/SK again.*
83 >
84 > *Agent: DO NOT execute any `configure set` command yourself.*
85
86#### 🔧 User's Responsibility (for documentation, NOT agent execution)
87
88The user configures credentials **outside the agent session** (in their own terminal):
89
90```bash
91# One-time setup — run this in your terminal, NOT in the agent chat
92HISTCONTROL=ignorespace
93 hcloud configure set --cli-access-key=<YOUR_AK> --cli-secret-key=<YOUR_SK>
94```
95
96> ⚠️ **Note**: hcloud CLI does **NOT** read `HW_ACCESS_KEY`/`HW_SECRET_KEY` environment variables (those are for Python SDK only). `hcloud configure set` is the only supported credential configuration method.
97
98---
99
100## Workflow
101
102### Step 1: Identify the Operation
103
104Determine which training operation the user needs based on their request:
105
106| User Intent | Operation Category |
107|-------------|-------------------|
108| Create/list/show/stop/delete training jobs | Training Job Management |
109| Create/list/show/update/delete algorithms | Algorithm Management |
110| Create/show/delete training job tags | Training Job Tags |
111| Create/list/show/update/delete experiments | Training Experiments |
112| Query job events, stages, tasks | Training Job Events |
113| Import/list/show/delete models | Model Import |
114| Query auto search trials, params analysis | Auto Search |
115| Save training job image | Training Image Save |
116
117### Step 2: Execute CLI Command
118
119```bash
120hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
121```
122
123> `{region}` must be replaced with the actual region, e.g., `cn-north-4`. Do NOT hardcode the region.
124
125### Step 2.5: ⚠️ Pre-Flight Check (MANDATORY for Write Operations)
126
127> **Before executing ANY write operation** (Create/Update/Delete/Stop/Change/Patch/Notify/Accept), you MUST:
128>
129> 1. **Read [references/known-issues.md](references/known-issues.md)** — Scan the relevant section for the target API
130> 2. **Apply documented workarounds** — Especially for the following high-risk operations:
131>
132> | Operation | Critical Issue | Action Required |
133> |-----------|--------------|----------------|
134> | CreateTrainingJob | Must use v2 `kind/metadata/spec/tasks` format | Use `--cli-jsonInput` with v2 JSON structure |
135> | CreateTrainingJob (dedicated pool) | `flavor_id` not accepted for dedicated pools | Omit `flavor_id`, specify `pool_id` instead |
136> | CreateAlgorithm | JSON must use nested `metadata` + `job_config` structure | Use `--cli-jsonInput` with correct nesting (see known-issues #27) |
137> | CreateAlgorithm | OBS code directory must exist and be accessible | Verify OBS path before calling API |
138> | StopTrainingJob | Can only stop jobs in `creating`/`waiting`/`running` state | Check job status first |
139> | CreateModel | `source_location` format must be `obs://bucket/path/` | Verify OBS path format |
140> | CreateModel | `model_type` must be a valid value | Check known-issues #22 for valid values |
141> | CreateSaveImageJob | Requires job in `running` state; SWR namespace required | Verify job status and SWR config |
142> | ChangeAlgorithm | Must include `--metadata.name` parameter | Add `metadata.name` to request |
143> | NotifyTrainingJobInformation | Parameter names differ from API docs | Check known-issues #24 |
144> | UpdateTrainingJob | Not a valid CLI operation | Use `ChangeTrainingJob` instead |
145>
146> **Skipping this step will cause preventable failures.** Every issue in the table was discovered through real API testing.
147
148### Step 3: Pricing Inquiry (for chargeable operations)
149
150Before executing **chargeable write operations** (CreateTrainingJob on public resource pool, CreateTrainingExperiment), perform a BSS pricing inquiry to show estimated costs to the user.
151
152> **📖 For detailed pricing inquiry procedures, read [references/pricing-inquiry.md](references/pricing-inquiry.md)**
153
154#### Chargeable Operations
155
156| Operation | Needs Inquiry | Condition |
157|-----------|--------------|-----------|
158| CreateTrainingJob | ✅ Yes | When using **public resource pool** (no `pool_id` specified) |
159| CreateTrainingJob | ❌ No | When using **dedicated resource pool** (`pool_id` specified — pool already billed) |
160| CreateTrainingExperiment | ✅ Yes | Experiments may launch training jobs with compute costs |
161| All other operations | ❌ No | Read operations, deletes, stops, tags, etc. do not incur charges |
162
163#### Inquiry Workflow
164
165```
1661. Detect chargeable operation (CreateTrainingJob without pool_id)
1672. Extract flavor_id from spec.resource.flavor_id parameter
1683. Get project ID via IAM KeystoneListAuthProjects
1694. Call BSS ListOnDemandResourceRatings to query on-demand price
1705. Calculate estimated cost: unit_price × node_count × estimated_duration
1716. Display price table and cost estimate to user
1727. Proceed to Step 4 (user confirmation) after showing pricing info
173```
174
175#### Quick Pricing Query
176
177Use the helper script for quick price queries:
178
179```bash
180# Query single flavor
181bash scripts/query-pricing.sh --region cn-north-4 --flavor modelarts.bm.gpu.v100
182
183# Query multiple flavors for comparison
184bash scripts/query-pricing.sh --region cn-north-4 --flavor modelarts.bm.gpu.v100 --flavor modelarts.cpu.8u32g --flavor modelarts.bm.ascend910
185```
186
187#### BSS Inquiry Parameters (Fixed)
188
189| Parameter | Value | Description |
190|-----------|-------|-------------|
191| `cloud_service_type` | `hws.service.type.modelarts` | ModelArts service type |
192| `resource_type` | `hws.resource.type.modelarts` | ModelArts resource type |
193| `usage_measure_id` | `4` | Hour (billing unit) |
194| `size_measure_id` | `14` | Instance count |
195| BSS API region | `cn-north-1` | BSS API always uses cn-north-1 |
196
197### Step 4: Handle Write Operations
198
199For all write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept/Batch), **prompt the user for confirmation before execution**. For chargeable operations, confirmation includes reviewing the pricing information from Step 3.
200
201### Step 5: Generate Console URL (after CreateTrainingJob)
202
203After successfully creating a training job, generate and display the **ModelArts console URL** so the user can directly access the job details in the web console.
204
205#### URL Format
206
207**Training job detail page** (after CreateTrainingJob):
208
209```
210https://console.huaweicloud.com/modelarts/?region={region}#/training/detail/{job_id}
211```
212
213**Training job list page** (after ListTrainingJobs):
214
215```
216https://console.huaweicloud.com/modelarts/?region={region}#/training
217```
218
219| Component | Description | Example |
220|-----------|-------------|---------|
221| `{region}` | The region where the job was created | `cn-north-4` |
222| `{job_id}` | Training job ID returned by CreateTrainingJob | `39cefbeb-0d86-46cb-a55a-fe6a62f3529b` |
223
224> **Important**: Use `#/training/detail/{job_id}` for detail and `#/training` for list (new console paths). Do NOT use `#/trainingJobs/details/{job_id}` or `#/trainingJobs` — those are deprecated old console paths.
225
226#### Workflow
227
228```
2291. CreateTrainingJob returns job_id in the response
2302. Construct console URL: https://console.huaweicloud.com/modelarts/?region={region}#/training/detail/{job_id}
2313. Display the URL to the user with a summary of the created job
232```
233
234#### Example Output
235
236```
237✅ Training job created successfully!
238
239 Job Name: my-training-job
240 Job ID: 39cefbeb-0d86-46cb-a55a-fe6a62f3529b
241 Status: creating
242 Region: cn-north-4
243
244 🔗 Console URL:
245 https://console.huaweicloud.com/modelarts/?region=cn-north-4#/training/detail/39cefbeb-0d86-46cb-a55a-fe6a62f3529b
246```
247
248> **Note**: The console URL uses hash routing (`#/training/detail/{job_id}`). Do NOT use the old path `#/trainingJobs/details/{job_id}` — it redirects to a deprecated console page. The URL is valid as long as the training job exists and the user has ModelArts access permissions for the region.
249
250---
251
252## KooCLI Command Format Standard
253
254```bash
255hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
256```
257
258| Feature | Description | Example |
259|---------|-------------|---------|
260| Service name | Fixed: `ModelArts` | `ModelArts` |
261| Operation name | PascalCase | `ListTrainingJobs`, `CreateTrainingJob` |
262| Region parameter | `--cli-region={region}` | `--cli-region=cn-north-4` |
263| Simple parameter | `--key=value` | `--training_job_id=xxx` |
264| Indexed parameter | `--key.1=value1` | `--tasks.1.role=worker` |
265| project_id | Auto-resolved if omitted | Uses configured project ID |
266
267> **Note**: `--project_id` is auto-resolved from authentication credentials if omitted. Include it explicitly only when targeting a specific project.
268
269> **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.
270
271---
272
273## Core Commands
274
275All 52 CLI command examples across 8 functional domains are documented in a separate reference file.
276
277> **📖 For detailed command syntax, parameters, and examples, read [references/cli-command-examples.md](references/cli-command-examples.md)**
278
279### Quick Index
280
281| # | Domain | APIs | Key Operations |
282|---|--------|------|----------------|
283| 1 | Training Job Management | 14 | CreateTrainingJob, ListTrainingJobs, ShowTrainingJobDetails, StopTrainingJob, DeleteTrainingJob, ShowTrainingJobLogs/Metrics/Engines/Flavors/Quotas |
284| 2 | Algorithm Management | 7 | CreateAlgorithm, ListAlgorithms, ShowAlgorithmByUuid, ChangeAlgorithm, DeleteAlgorithm, ShowSearchAlgorithms, CreateAlgorithmVersionToGallery |
285| 3 | Training Job Tags | 3 | CreateTrainJobTags, ShowTrainJobTags, DeleteTrainJobTags |
286| 4 | Training Experiments | 6 | CreateTrainingExperiment, List/Show/Delete/Change/Check experiments |
287| 5 | Training Job Events | 7 | ListTrainingJobEvents/Stages/Tasks, ListEvents/Categories/ScheduledEvents, AcceptScheduledEvent |
288| 6 | Model Import | 6 | CreateModel, ListModels, ShowModel, DeleteModel, ShowModelEngineAndRuntime, CreateModelArtsAgency |
289| 7 | Auto Search | 7 | ShowAutoSearchTrials/PerTrial/ParamsAnalysis/YamlTemplates, ShowAutoSearchTrialEarlyStop |
290| 8 | Training Image Save | 2 | CreateSaveImageJob, ShowSaveImageJob |
291
292> When executing any command, always refer to the reference file for exact parameter names, required/optional flags, and usage patterns.
293
294---
295
296## Capability Boundary(能力边界)
297
298This skill covers **only** ModelArts training management — 52 APIs across 8 functional domains (see Core Commands above). The following ModelArts capabilities are **NOT supported**:
299
300| Unsupported Domain | Example Operations | Suggestion |
301|--------------------|--------------------|------------|
302| Notebook (Dev Environment) | CreateNotebook, ListNotebooks, ShowNotebook | Use ModelArts console or dedicated notebook skill |
303| Inference Service (Online Service) | CreateService, ListServices, ShowService | Use ModelArts console or inference skill |
304| Resource Pool / Cluster | CreateResourcePool, ListResourcePools | Use ModelArts console |
305| Workflow Orchestration | CreateWorkflow, ListWorkflows | Use ModelArts console |
306| Image Management (SWR) | ListImages, ShowImage | Use SWR console or CLI directly |
307| DevServer | CreateDevServer, ListDevServers | Use ModelArts console |
308| Workspace Management | CreateWorkspace, ListWorkspaces | Use ModelArts console |
309
310> When receiving requests for the above unsupported capabilities, **explicitly inform the user** that this skill does not support them, and suggest using the ModelArts console (`https://console.huaweicloud.com/modelarts/`) or the relevant dedicated skill.
311
312---
313
314## Parameter Confirmation
315
316| Parameter | Required | Description | Example |
317|-----------|----------|-------------|---------|
318| `{region}` | Yes | Huawei Cloud region | `cn-north-4`, `cn-east-3` |
319| `{training_job_id}` | Job ops | Training job UUID | `xxx-xxx-xxx` |
320| `{algorithm_id}` | Algorithm ops | Algorithm UUID | `xxx-xxx-xxx` |
321| `{experiment_id}` | Experiment ops | Training experiment UUID | `xxx-xxx-xxx` |
322| `{model_id}` | Model ops | Model UUID | `xxx-xxx-xxx` |
323| `{job_id}` | SaveImage ops | Save image job UUID | `xxx-xxx-xxx` |
324| `{project_id}` | No (auto) | Project ID, auto-resolved if omitted | Omit for default |
325| `{workspace_id}` | No | Workspace ID | Omit for default workspace |
326
327---
328
329## SDK Fallback
330
331If a CLI operation fails due to a CLI bug, fall back to SDK:
332
333```python
334from huaweicloudsdkcore.auth.credentials import BasicCredentials
335from huaweicloudsdkmodelarts.v2.modelarts_client import ModelArtsClient
336from huaweicloudsdkmodelarts.v2.region.modelarts_region import ModelArtsRegion
337
338credentials = BasicCredentials(ak="{AK}", sk="{SK}", project_id="{project_id}")
339client = ModelArtsClient.new_builder() \
340 .with_credentials(credentials) \
341 .with_region(ModelArtsRegion.value_of("{region}")) \
342 .build()
343```
344
345---
346
347## Reference Documents
348
349| Document | Description |
350|----------|-------------|
351| [references/cli-command-examples.md](references/cli-command-examples.md) | Detailed CLI command syntax and examples for all 52 APIs |
352| [references/pricing-inquiry.md](references/pricing-inquiry.md) | BSS on-demand pricing inquiry for training jobs (pre-creation cost estimation) |
353| [references/iam-policies.md](references/iam-policies.md) | Least-privilege IAM policies |
354| [references/verification-method.md](references/verification-method.md) | Verification and testing methods |
355| [references/dataflow-diagram.md](references/dataflow-diagram.md) | Mermaid data flow diagram |
356| [references/acceptance-criteria.md](references/acceptance-criteria.md) | Acceptance criteria checklist |
357| [references/api-paths.md](references/api-paths.md) | REST API paths from SDK source |
358| [references/cli-installation-guide.md](references/cli-installation-guide.md) | CLI installation and authentication guide |
359| [references/known-issues.md](references/known-issues.md) | Known issues and workarounds |
360
361---
362
363## Known Issues Summary
364
365- **Complex nested params**: Use `--cli-jsonInput` with JSON file for CreateTrainingJob, CreateAlgorithm, CreateModel, etc.
366- **`--cli-jsonInput` syntax**: Use file path directly (no `@` prefix), JSON must be wrapped in `{"body": {...}}`
367- **Training job logs**: `ShowObsUrlOfTrainingJobLogs` returns a temporary OBS URL (valid for 5 minutes)
368- **StopTrainingJob**: Can only stop jobs in `creating`, `waiting`, or `running` state
369- **Auto search**: Trial early stop only works on running trials
370
371> See [references/known-issues.md](references/known-issues.md) for full details.
372
373---
374
375## Notes
376
377- All write operations (Create/Update/Delete/Stop/Change/Patch/Notify/Accept) require user confirmation before execution
378- **Pricing inquiry**: CreateTrainingJob (public pool) and CreateTrainingExperiment trigger BSS pricing inquiry before execution — see [references/pricing-inquiry.md](references/pricing-inquiry.md)
379- **Dedicated resource pool**: Training jobs using a dedicated resource pool (`pool_id` specified) do NOT require pricing inquiry — the pool is already billed
380- Region is not hardcoded — uses `{region}` placeholder
381- `project_id` is auto-resolved when omitted
382- No hardcoded AK/SK in any file — credentials configured via `hcloud configure set` by the user outside the agent session
383- Agent must use `hcloud configure list` for credential presence check only — NEVER read/echo AK/SK values
384- If no valid credentials found, agent must STOP and guide user through the 3-step configuration process (see Prerequisites section)
385- SDK fallback available when CLI encounters bugs
386- Complex nested parameters use `--cli-jsonInput` with JSON file