huaweicloud/huaweicloud-skills

huawei-cloud-functiongraph-trigger-create

Create and configure scheduled TIMER triggers for Huawei Cloud FunctionGraph functions using Quartz Cron expressions.

Vedi sorgente
Documento Skill originale

Contenuto dal repository con titoli, esempi, codice, tabelle, link e immagini preservati.

Overview

This skill enables the creation and configuration of scheduled triggers (TIMER type) for Huawei Cloud FunctionGraph functions. It supports Quartz Cron expression format for flexible scheduling configurations.

The trigger allows automatic execution of serverless functions at specified time intervals, making it ideal for:

  • Periodic data processing tasks
  • Scheduled backup operations
  • Regular monitoring and health checks
  • Time-based notification systems

Prerequisites

Before using this skill, ensure the following requirements are met:

  1. Python Environment: Python 3.9+ installed
  2. SDK Installation: Install FunctionGraph SDK: pip install huaweicloudsdkfunctiongraph
  3. Environment Variables: Configure the following environment variables:
  • HUAWEI_AK: Huawei Cloud Access Key
  • HUAWEI_SK: Huawei Cloud Secret Key
  • HUAWEI_REGION: Target region (e.g., cn-north-4)
  • HUAWEI_PROJECT_ID: Project ID
  1. FunctionGraph Function: Target function must already exist in the specified region
  2. Network Access: Stable network connection to Huawei Cloud API endpoints

Usage

Basic Command Structure

bash
cd scripts
python create_trigger.py \
    --function-urn "urn:fss:cn-north-4:project_id:function:default:my-function:latest" \
    --name "daily-trigger" \
    --schedule "0 0 2 * * ?" \
    --schedule-type "Cron" \
    --status "ACTIVE"

Examples

Cron Expression Trigger

bash
cd scripts
python create_trigger.py \
    --function-urn "urn:fss:cn-north-4:project_id:function:default:my-function:latest" \
    --name "daily-trigger" \
    --schedule "0 0 8 * * ?" \
    --schedule-type "Cron"

Fixed Rate Trigger

bash
cd scripts
python create_trigger.py \
    --function-urn "urn:fss:cn-north-4:project_id:function:default:my-function:latest" \
    --name "every-5min" \
    --schedule "5m" \
    --schedule-type "Rate"

Cron Expression Format

FunctionGraph uses Quartz Cron format with 6 or 7 fields:

┌───────────── second (0-59)
│ ┌───────────── minute (0-59)
│ │ ┌───────────── hour (0-23)
│ │ │ ┌───────────── day of month (1-31)
│ │ │ │ ┌───────────── month (1-12)
│ │ │ │ │ ┌───────────── day of week (1-7, 1=Sunday)
│ │ │ │ │ │
* * * * * ?

For detailed Cron expression reference including special characters and common examples, see Cron Expression Reference.

Parameters Confirmation

Before creating the trigger, confirm the following parameters:

ParameterRequiredDescriptionExample
function_urnYesTarget function URNurn:fss:cn-north-4:xxx:function:default:my-func:latest
trigger_nameYesTrigger name (1-64 chars)daily-trigger
scheduleYesCron expression or Rate value0 0 2 * * ? or 5m
schedule_typeNoCron (default) or RateCron
enable_statusNoACTIVE (default) or DISABLEDACTIVE
user_eventNoAdditional user event dataoptional info

Confirmation Checklist

  • [ ] Function URN is correct and function exists
  • [ ] Cron expression has been validated
  • [ ] Trigger name follows naming conventions
  • [ ] IAM permissions are sufficient
  • [ ] Region matches the function location

Output Format

Success Response

json
{
    "status": "success",
    "trigger_id": "timer-xxx-xxx-xxx",
    "trigger_name": "daily-trigger",
    "trigger_type": "TIMER",
    "schedule": "0 0 2 * * ?",
    "enable_status": "ACTIVE",
    "message": "Trigger created successfully"
}

Error Response

json
{
    "status": "failed",
    "error_code": "TriggerAlreadyExists",
    "message": "Trigger with the same name already exists"
}

For complete error codes and troubleshooting information, see Cron Expression Reference.

Verification Method

After creating the trigger, verify the configuration:

1. List Function Triggers

Navigate to FunctionGraph console → Function details → Triggers tab to view all triggers

2. Check Trigger Details

Navigate to FunctionGraph console → Function details → Triggers → View trigger details

3. Monitor Trigger Execution

Navigate to FunctionGraph console → Function details → Triggers → View execution history

Expected indicators:

  • Trigger status: Active
  • Next execution time: Correctly calculated
  • Execution history: No failed invocations

Best Practices

Cron Expression Best Practices

  1. Avoid frequent executions: Use intervals ≥ 5 minutes unless necessary
  2. Consider timezone: FunctionGraph uses UTC by default
  3. Use `?` for unused day field: Either day-of-month or day-of-week should use ?
  4. Validate before creation: Test expressions using online Cron validators

Naming Conventions

  • Use descriptive names: daily-data-sync, hourly-health-check
  • Follow pattern: [frequency]-[purpose]
  • Maximum 64 characters
  • Use lowercase with hyphens

Security Considerations

  1. Least privilege: Grant minimal IAM permissions
  2. Enable encryption: Use KMS for sensitive function inputs
  3. Monitor executions: Set up Cloud Eye alarms for failures
  4. Rate limiting: Configure appropriate retry parameters

Operational Recommendations

  1. Start with disabled status for testing
  2. Document trigger purpose in description field
  3. Set appropriate retries for transient failures
  4. Monitor first executions after enabling

Reference Documents

For detailed information, refer to:

Important Notes

Compatibility Notes

This skill is designed to work with Huawei Cloud FunctionGraph API. The tags field helps with skill discovery and categorization, while the version field follows semantic versioning for skill updates.

Limitations

  1. Maximum triggers: Each function supports up to 10 triggers by default
  2. Cron precision: Second-level scheduling may have minor delays
  3. Timeout handling: Function timeout should be less than trigger interval
  4. Cold start: First executions may have additional latency

Cost Implications

  • No additional cost for trigger configuration
  • Function execution billed per invocation
  • Consider execution frequency for cost optimization

Common Pitfalls

  1. Wrong timezone: Remember FunctionGraph uses UTC
  2. Overlapping schedules: Multiple triggers may cause concurrent executions
  3. Long-running functions: Ensure function completes before next trigger
  4. Cron syntax errors: Validate expression format before deployment

For troubleshooting and error codes, refer to Cron Expression Reference.


Related Skills:

  • huawei-cloud-functiongraph-function-create
  • huawei-cloud-functiongraph-deploy
dallo stesso repository

Altri Skills

Tutti gli 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.

installazioni
5
GitHub Stars
50
Aggiornato
23 set
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 告警", "成本分析", "闲置监控", "操作审计"

installazioni
1
GitHub Stars
50
Aggiornato
22 set
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平台.

installazioni
1
GitHub Stars
50
Aggiornato
22 set
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工作流

installazioni
1
GitHub Stars
50
Aggiornato
22 set