huaweicloud/huaweicloud-skills

huawei-cloud-modelarts-training-management

Manage Huawei Cloud ModelArts training jobs and related resources through full lifecycle operations via hcloud CLI.

View source
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

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

  1. hcloud CLI installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli02003.html
  2. Huawei Cloud AK/SK configured via hcloud (see Security & Credential Check below)
  3. ModelArts service enabled in the target region
  4. 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)

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 <YOURAK>` and `<YOURSK> 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:

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

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.

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: 1. Read [references/known-issues.md](references/known-issues.md) — Scan the relevant section for the target API 2. 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](references/pricing-inquiry.md)

Chargeable Operations

OperationNeeds InquiryCondition
CreateTrainingJob✅ YesWhen using public resource pool (no pool_id specified)
CreateTrainingJob❌ NoWhen using dedicated resource pool (pool_id specified — pool already billed)
CreateTrainingExperiment✅ YesExperiments may launch training jobs with compute costs
All other operations❌ NoRead 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:

bash
# 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)

ParameterValueDescription
cloud_service_typehws.service.type.modelartsModelArts service type
resource_typehws.resource.type.modelartsModelArts resource type
usage_measure_id4Hour (billing unit)
size_measure_id14Instance count
BSS API regioncn-north-1BSS 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
ComponentDescriptionExample
{region}The region where the job was createdcn-north-4
{job_id}Training job ID returned by CreateTrainingJob39cefbeb-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

bash
hcloud ModelArts <Operation> --cli-region={region} [--key=value ...]
FeatureDescriptionExample
Service nameFixed: ModelArtsModelArts
Operation namePascalCaseListTrainingJobs, 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_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.

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](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.

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 DomainExample OperationsSuggestion
Notebook (Dev Environment)CreateNotebook, ListNotebooks, ShowNotebookUse ModelArts console or dedicated notebook skill
Inference Service (Online Service)CreateService, ListServices, ShowServiceUse ModelArts console or inference skill
Resource Pool / ClusterCreateResourcePool, ListResourcePoolsUse ModelArts console
Workflow OrchestrationCreateWorkflow, ListWorkflowsUse ModelArts console
Image Management (SWR)ListImages, ShowImageUse SWR console or CLI directly
DevServerCreateDevServer, ListDevServersUse ModelArts console
Workspace ManagementCreateWorkspace, ListWorkspacesUse 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

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

Reference Documents

DocumentDescription
references/cli-command-examples.mdDetailed CLI command syntax and examples for all 52 APIs
references/pricing-inquiry.mdBSS on-demand pricing inquiry for training jobs (pre-creation cost estimation)
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

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
from this repository

More skills

All skills
huaweicloud
Community

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

installs
5
GitHub stars
50
Updated
Sep 23
huaweicloud
Community

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

installs
1
GitHub stars
50
Updated
Sep 22
huaweicloud
Community

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

installs
1
GitHub stars
50
Updated
Sep 22
huaweicloud
Community

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

installs
1
GitHub stars
50
Updated
Sep 22