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 训练", "训练实验", "自动搜索", "超参调优".
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
text
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
⚠️ 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)
bash
# 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):
bash
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):
bash
# 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:
Before executing chargeable write operations (CreateTrainingJob on public resource pool, CreateTrainingExperiment), perform a BSS pricing inquiry to show estimated costs to the user.
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
text
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
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.
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):
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
text
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
text
✅ 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.
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.
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:
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()