SuperAPI AI Directory

alibabacloud-ehpc-instant-job-skill

Deployment & operations

View repository

Updated 10-16 04:59

About this skill

Alibaba Cloud E-HPC Instant Job Management Skill

Skill Overview

Through Alibaba Cloud CLI (preferred) or SDK tools, implement full lifecycle management of E-HPC Instant computing platform jobs and computing resources.

Interaction Principles

  • User-friendly: Use "you" instead of "you", maintaining a professional and friendly tone
  • Transparent operations: All key configuration information must be shown to the user and confirmed
  • Security first: Follow the principle of least privilege and avoid accidental operations
  • Error handling: Provide clear error messages and solutions
  • Format specifications: Use a simple, clear, and readable output format

Execution Flow

  • Step1: Configuration preloading
  • Step2: Prerequisite verification
  • Step3: Job management execution
  • Step4: Job task execution result output

Step 1: Configuration Preloading

[MUST] You must first attempt to read the ./jobconfig/pre-config.json file. Skipping this check step is strictly prohibited.

  • The file exists and is read successfully: Load the parameter values in it, notify the user that the pre-configuration has been loaded and display a summary of key parameters, then proceed to Step 2.
  • The file does not exist: Notify the user that no pre-configuration file was detected, and that the necessary parameters will be obtained interactively in Step 2, then proceed to Step 2.
  • The file exists but reading/parsing fails(e.g., JSON format error, insufficient permissions, etc.): Report the specific error information to the user, and ask whether to continue (skip pre-configuration and proceed to Step 2) or abort execution.

Step 2: Prerequisite Verification

Common verification for all job management tasks

  1. Alibaba Cloud CLI configuration: Verify that the CLI is installed and AccessKey is configured
    • CLI version requirement >= 3.3.3: Run aliyun version to verify version >= 3.3.3. If it is not installed or the version is too low, refer to the installation instructions in references/aliyun-cli.md to install or update.
    • [MUST] Run aliyun configure set --auto-plugin-install true to enable automatic plugin installation.
    • [MUST] Run aliyun plugin update to ensure the installed plugin is always the latest version.
    • If there is no configuration, guide the user through interactive installation and configuration
    • Reference:references/aliyun-cli.md
    • [MUST] CLI User-Agent — Each aliyun CLI command invocation must include:--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill
    • Enable Alibaba Cloud CLI AI mode: Run the following initialization command, appending the AI identity information for this Skill execution:
    aliyun configure ai-mode enable
    aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill"
    aliyun plugin update
    

    Alibaba Cloud CLI provides an AI mode. Once enabled, the CLI automatically appends AI identity information, enabling the server side to identify and optimize the Agent invocation chain. [MUST] Disable AI mode at every exit point — Before delivering the final response for any reason, be sure to disable AI mode first. This applies to all exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any scenario where CLI commands will no longer be executed. AI mode is only used for Agent Skill invocation scenarios; after the skill stops running,mustremain disabled.

    aliyun configure ai-mode disable
    
  2. Region information: obtain the user-specified region or use the default regioncn-shanghai
  3. Permission verification: ensure the AccessKey has E-HPC Instant-related permissions

Special verification for creating job tasks

  1. Image preparation: the container/VM image has been added to the E-HPC Instant platform
  2. Network configuration: the vSwitch has been created and is available
  3. Storage configuration: the NAS mount path is ready (if needed)
  4. Compute resource configuration: the Cores/Memory or InstanceType specification has been specified
  5. Execution command: the job execution command line has been specified

Step 3: Job management execution

Execute the corresponding job management operation according to user needs

Create job

  1. Container job
aliyun ehpcinstant CreateJob \
    --region cn-shanghai \
    --JobName 'container-job' \
    --Tasks '[{
        "TaskSpec": {
            "TaskExecutor": [{
                "Container": {
                    "Image": "registry.cn-shanghai.aliyuncs.com/registry/image:tag",
                    "Command": "[\"/bin/sh\", \"-c\", \"python /app/main.py\"]"
                }
            }],
            "Resource": {
                "Cores": 2,
                "Memory": 4,
                "Disks": [{"Type":"System","Size":40}]
            },
	    "VolumeMount": [
              {
                "MountPath": "/mnt",
                "VolumeDriver": "alicloud/nas",
                "MountOptions": "{\"server\":\"xxx.cn-shanghai.nas.aliyuncs.com\",\"vers\":\"3\",\"path\":\"/\",\"options\":\"nolock,tcp,noresvport\"}"
              }
            ],
        },
        "ExecutorPolicy": {"MaxCount": 1}
    }]' \
    --DeploymentPolicy '{"Network":{"Vswitch":["vsw-xxxx"]},"AllocationSpec":"Standard"}' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill
  1. VM virtual machine job
aliyun ehpcinstant CreateJob \
    --region cn-shanghai \
    --JobName 'longrunning-job' \
    --JobDescription 'Long-running VM job' \
    --Tasks '[{
        "TaskSpec": {
            "TaskExecutor": [{
                "VM": {
                    "Image": "m-xxxx",
                    "Script": "base64_encoded_script"
                }
            }],
            "Resource": {
                "Disks": [{"Type":"System","Size":50}],
                "InstanceTypes": ["ecs.c6.xlarge"],
                "Cores": 4,
                "Memory": 8
            },
	    "VolumeMount": [
              {
                "MountPath": "/mnt",
                "VolumeDriver": "alicloud/nas",
                "MountOptions": "{\"server\":\"xxx.cn-shanghai.nas.aliyuncs.com\",\"vers\":\"3\",\"path\":\"/\",\"options\":\"nolock,tcp,noresvport\"}"
              }
            ],
        },
        "ExecutorPolicy": {"MaxCount": 1}
    }]' \
    --DeploymentPolicy '{"Network":{"Vswitch":["vsw-xxxx"]},"AllocationSpec":"Standard"}' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

Query job list

# 基本列表查询
aliyun ehpcinstant ListJobs --region cn-shanghai \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

# 分页查询(推荐用于大量作业)
aliyun ehpcinstant ListJobs --region cn-shanghai --PageSize 10 --PageNumber 1 \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

# 条件过滤(按状态、时间等)
aliyun ehpcinstant ListJobs --region cn-shanghai --Filter '{"Status":"Running"}' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

Get job details

aliyun ehpcinstant GetJob --region cn-shanghai --JobId 'job-xxxx' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

Query job logs

aliyun ehpcinstant DescribeJobResults --region cn-shanghai --JobId 'job-sh145rw47pegztzdpu7s' --TaskName Task0 --ArrayIndex 0 \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

Delete job

# 删除单个作业
aliyun ehpcinstant DeleteJobs --region cn-shanghai --JobSpec '[{"JobId":"job-xxxx"}]' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

# 批量删除(安全方式)
aliyun ehpcinstant DeleteJobs --region cn-shanghai --JobSpec '[{"JobId":"job-xxxx"},{"JobId":"job-yyyy"}]' \
    --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ehpc-instant-job-skill

[MUST] Idempotent deletion principle — When the user requests to delete a job, even if a GetJob or ListJobs query confirms that the job no longer exists, the Agent must stillcall the DeleteJobs API and pass in the corresponding JobId. The DeleteJobs API is idempotent: when the job exists, it performs deletion; when the job does not exist, it returns a standard NotFound response. The Agent is strictly prohibited from skipping the API call on the grounds that "the job no longer exists" — the server must confirm the final state.

Step 4: Result output and follow-up suggestions

  • Format and output the execution result
  • Provide follow-up operation suggestions (such as monitoring, log viewing, etc.)
  • Record key information for future reference

Job management reference execution scripts

Path:/home/admin/.openclaw/workspace/skills/ehpcinstant-job-skill/scripts/

CLI scripts:

  • create_container_job.sh - Create container job
  • create_vm_job_batch.sh - Create VM job
  • create_vm_job_longrunning.sh - Create long-running VM job
  • list_jobs.sh - List jobs (supports pagination)
  • get_job.sh - Get job details
  • delete_jobs.sh - Delete job

SDK scripts:

  • The corresponding Python SDK version scripts, located inscripts/sdk/directory
  • create_container_job.py - Create container job
  • create_vm_job_batch.py - Create VM job
  • create_vm_job_longrunning.py - Create long-running VM job
  • list_jobs.py - List jobs (supports pagination)
  • get_job.py - Get job details
  • delete_jobs.py - Delete job

Notes

  1. CLI command accuracy: E-HPC Instant usagealiyun ehpcinstantcommand, notaliyun ehpc!
  2. Region consistency: All resources must be in the same region; cross-region operations will fail
  3. Quota limits: Pay attention to account quota limits to avoid operation failures
  4. Cost awareness: Running jobs incurs charges; promptly clean up unneeded resources
  5. Least privilege: Configure the minimum necessary permissions for the AccessKey to improve security

Troubleshooting and best practices

Common problem solutions

Problem Root cause Solution
InvalidCommand error The Command parameter format is incorrect Use the correct JSON array format:["/bin/sh", "-c", "command"]
Authentication failed AccessKey configuration error or insufficient permissions Check~/.aliyun/config.jsonconfiguration and ensure it has E-HPC Instant permissions
Image does not exist Image ID is incorrect or the region does not match Confirm that the image ID is correct and in the same region, refer toreferences/instant-image.md
Network configuration error VSwitch ID is incorrect or unavailable Check the VSwitch ID and security group configuration, refer toreferences/vswitch.md
Insufficient resource quota Account quota limit Contact Alibaba Cloud to increase the quota, or adjust the resource configuration
Command execution failed Incorrect command path inside the container Ensure the command is executable in the image environment and use an absolute path

Best practices guide

  1. Naming conventions:

    • Job name:应用-算例-时间戳(for example:prod-training-20260411)
    • Resource name: include purpose, environment, and region information
  2. Resource configuration optimization:

    • Choose an appropriate instance specification based on application characteristics
    • Avoid resource waste caused by over-provisioning
  3. Cost control:

    • Promptly clean up completed jobs
    • Use appropriate job timeout settings
    • Monitor resource usage
  4. Reliability assurance:

    • Implement job status monitoring and retry mechanisms
    • Configure appropriate error handling and alerts
    • Regularly back up important configurations and data
  5. Security enhancement:

    • Use a private image repository
    • Configure an AccessKey with least privilege
    • Enable network access control and encryption

References and extensions

Complete API reference

If you are still unsure about the job management execution parameters, you can refer to the following link:

Special configuration guide

Official documentation

Security Policy and Risk Control

Operation Risk Level Classification

Risk Level Operation Type Agent Code of Conduct
Low Risk Query-type operations (list, get, check, describe) Execute directly, no additional confirmation required
Medium Risk Configuration-type operations (configure, modify, update) Indicate the scope of impact, execute after obtaining user confirmation
High Risk Create/delete-type operations (create, delete, remove) Must fully display all configuration information, execute after explicit user confirmation

[MUST] Do not skip API calls — When performing operations such as deletion, the Agent must not, based on query results (e.g., GetJob returning NotFound), determine on its own that "no operation is needed" and skip the actual API call. There is a time window between the query and the change, and the server-side state may have already changed. The Agent must always execute the target API requested by the user (e.g., DeleteJobs), and let the server return the authoritative final result.

Security Check List

  • ✅ Region Consistency: Ensure all resources are in the same region
  • ✅ Quota Check: Verify whether resource quotas are sufficient
  • ✅ Dependency Verification: Confirm that dependent resources (images, networks, storage) exist and are available
  • ✅ Permission Verification: Ensure the AccessKey has the necessary permissions
  • ✅ Cost Reminder: Give a reminder for operations that may incur higher costs

Sensitive Operation Confirmation Process

  1. Information Summary: Display all key configuration parameters
  2. Impact Description: Explain the scope of impact and potential risks of the operation
  3. User Confirmation: Wait for explicit user confirmation ("yes", "confirm", "continue", etc.)
  4. Execute Operation: Execute the confirmed operation
  5. Result Feedback: Provide detailed operation results and follow-up suggestions