alibabacloud-dts-task-query
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese⚠️ CRITICAL OUTPUT COMPLETENESS REQUIREMENT
⚠️ 关键输出完整性要求
When using this skill, you MUST output the COMPLETE script result without ANY truncation, omission, or summarization. The script outputs EVERY task row in full - your model response MUST do the same. NEVER use "..." placeholders or summarize task counts. Display ALL rows exactly as shown.
使用此技能时,必须输出完整的脚本结果,不得进行任何截断、遗漏或总结。脚本会输出每一条任务的完整信息——你的模型响应必须完全一致。绝不能使用"..."占位符或总结任务数量,要精确显示所有行内容。
DTS Task Status Query
DTS任务状态查询
Query DTS task status using Alibaba Cloud CLI. Outputs results in Chinese.
使用阿里云CLI查询DTS任务状态,输出结果为中文。
Prerequisites
前提条件
CRITICAL: AI-Mode and Plugin Setup Required
Before using this skill, you MUST configure AI-Mode and update plugins:
bash
undefined关键要求:必须配置AI-Mode和插件
使用此技能前,必须配置AI-Mode并更新插件:
bash
undefinedEnable AI-Mode for plugin-based API calls
启用AI-Mode以支持基于插件的API调用
aliyun configure ai-mode enable
aliyun configure ai-mode enable
Set user agent for proper plugin compatibility
设置用户代理以确保插件兼容性
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-dts-task-query"
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-dts-task-query"
Update all plugins to latest version
将所有插件更新至最新版本
aliyun plugin update --all
aliyun plugin update --all
Verify DTS plugin is installed
验证DTS插件已安装
aliyun plugin list
aliyun plugin list
To disable AI-Mode later (if needed)
后续如需禁用AI-Mode(可选)
aliyun configure ai-mode disable
**Note**: This skill uses plugin mode commands (`aliyun dts describe-dts-jobs`). AI-Mode must be enabled for these commands to work correctly.aliyun configure ai-mode disable
**注意**:此技能使用插件模式命令(`aliyun dts describe-dts-jobs`),必须启用AI-Mode才能正常执行这些命令。Required RAM Permissions
所需RAM权限
See detailed RAM policy requirements in references/ram-policies.md.
详细RAM策略要求请参考references/ram-policies.md。
Supported Regions
支持地域
Automatically queries all 27 public cloud regions if no region is specified.
若未指定地域,将自动查询全部27个公有云地域。
Usage
使用方法
bash
python scripts/query_dts_tasks.py [--region <id>] [--instance-id <id>] [--job-name <name>] [--workers <N>]⚠️ MANDATORY - Model Response Rules:
- ALWAYS output COMPLETE data: Display every single task row without any omission
- NEVER truncate: No "..." placeholders, no "showing first N tasks", no summaries
- ALWAYS list ALL tasks: Every task in migration/sync/subscribe groups must be shown line-by-line
- Script outputs 100%: The script GUARANTEES complete output - your response MUST match 100%
- Remember: When the script has 23 tasks, you output ALL 23 rows. NO EXCEPTIONS.
Performance Tuning:
- : Number of concurrent API calls (default: 8). Recommended values:
--workers- 8: Default, stable performance (~10 seconds full scan)
- 12-16: Optimal for high-bandwidth networks (~6-8 seconds full scan)
- >16: May hit API rate limits or local resource constraints
Reliability Features (v12):
- API retry logic: Retries failed API calls up to 3 times with exponential backoff to ensure consistent results
- Problem solved: Eliminates count variations caused by transient API failures and timeouts
- Impact: Script now always returns the same task count (e.g., consistently 34 tasks instead of 32-34)
- v12.1: Increased timeout to 10s and added exponential backoff (0.2s, 0.4s) for better reliability
- Thread-safe collection: Uses Lock to prevent race conditions during parallel data collection
- Strict response validation: Only accepts responses with valid "DtsJobList" field
- Detailed error logging: Distinguishes between timeout errors and other exceptions for easier debugging
- Verified: Tested with 50+ consecutive runs - all returned identical results
bash
python scripts/query_dts_tasks.py [--region <id>] [--instance-id <id>] [--job-name <name>] [--workers <N>]⚠️ 强制模型响应规则:
- 始终输出完整数据:显示每一条任务记录,不得遗漏任何内容
- 绝不截断:不得使用"..."占位符、不得显示"仅展示前N条任务"、不得进行总结
- 始终列出所有任务:迁移/同步/订阅分组中的每一条任务必须逐行展示
- 脚本输出100%完整:脚本保证输出完整内容——你的响应必须与脚本输出100%一致
- 注意:当脚本输出23条任务时,你必须输出全部23行内容,无例外。
性能调优:
- :并发API调用数量(默认值:8)。推荐取值:
--workers- 8:默认值,性能稳定(全量扫描约10秒)
- 12-16:高带宽网络下的最优取值(全量扫描约6-8秒)
- >16:可能触发API速率限制或本地资源瓶颈
可靠性特性(v12版本):
- API重试逻辑:失败的API调用最多重试3次,采用指数退避策略,确保结果一致
- 解决的问题:消除因临时API故障和超时导致的任务数量波动
- 效果:脚本现在始终返回相同的任务数量(例如,始终返回34条任务,而非32-34条波动值)
- v12.1:将超时时间增加至10秒,并添加指数退避(0.2秒、0.4秒)以提升可靠性
- 线程安全收集:使用Lock防止并行数据收集时出现竞态条件
- 严格响应验证:仅接受包含有效"DtsJobList"字段的响应
- 详细错误日志:区分超时错误与其他异常,便于调试
- 已验证:经过50+次连续运行测试,所有测试均返回完全一致的结果
Execution Rules (Mandatory)
执行规则(强制)
- Full Polling: Must iterate through all 27 regions and 3 job types (,
MIGRATION,SYNC) unless a specific region is provided.SUBSCRIBE - Region Injection: The script must inject the field into each task object during the query phase.
_QueryRegion - Endpoint for Overseas Regions: For overseas regions, the script must add the parameter to query tasks successfully.
--endpoint - PayType Filtering: After reading the temporary file, strictly filter tasks to include ONLY those where is
PayTypeorPrePaid.PostPaid - Chinese Output: All output (summary and table headers) must be in Chinese. JobType must be mapped (e.g., migration -> 迁移).
- Grouped Output: Tasks are grouped by type (迁移/同步/订阅), with each group sorted by CreateTime (newest first).
- Parallel Execution: The script MUST use ThreadPoolExecutor for parallel queries (v11+). Default 8 workers, configurable via .
--workers - API Retry: The script retries failed API calls up to 3 times to ensure reliability (v12+).
- Thread Safety: The script uses Lock for thread-safe data collection to prevent race conditions (v12+).
- Parameter Strictness: MUST use the exact region ID and filter keywords provided in user input. DO NOT substitute regions (e.g. cn-shanghai) even if user input seems ambiguous.
- Filter Enforcement: If --job-name is provided, it MUST be passed to the script without omission.
- 全量轮询:除非指定了特定地域,否则必须遍历全部27个地域和3种任务类型(、
MIGRATION、SYNC)。SUBSCRIBE - 地域注入:脚本必须在查询阶段将字段注入到每个任务对象中。
_QueryRegion - 海外地域端点:针对海外地域,脚本必须添加参数才能成功查询任务。
--endpoint - 付费类型过滤:读取临时文件后,必须严格筛选出为
PayType或PrePaid的任务。PostPaid - 中文输出:所有输出内容(统计摘要和表格表头)必须为中文。任务类型需映射为中文(例如,migration → 迁移)。
- 分组输出:任务按类型(迁移/同步/订阅)分组,每组内按创建时间(最新优先)排序。
- 并行执行:脚本必须使用ThreadPoolExecutor进行并行查询(v11及以上版本)。默认8个工作线程,可通过配置。
--workers - API重试:脚本对失败的API调用最多重试3次以确保可靠性(v12及以上版本)。
- 线程安全:脚本使用Lock实现线程安全的数据收集,防止竞态条件(v12及以上版本)。
- 参数严谨性:必须使用用户输入中提供的精确地域ID和过滤关键词,不得替换地域(例如,即使用户输入模糊,也不得将cn-shanghai替换为其他值)。
- 过滤规则强制执行:若提供了--job-name参数,必须完整传递给脚本,不得遗漏。
Output Format
输出格式
1. 统计摘要
1. 统计摘要
- 任务总量: [Count]
- 地域分布: [List of regions and counts]
- 状态分布: [List of statuses and counts]
- 类型分布: [List of job types and counts]
- 任务总量: [数量]
- 地域分布: [地域及对应任务数量列表]
- 状态分布: [任务状态及对应数量列表]
- 类型分布: [任务类型及对应数量列表]
2. 任务明细
2. 任务明细
⚠️ CRITICAL - Output Completeness:
- Script GUARANTEES complete output: The script ALWAYS outputs ALL tasks without truncation
- ALWAYS display ALL rows: Every single task MUST be listed row-by-row, no exceptions
- NEVER use placeholders: No "..." or similar truncation symbols - show EVERY task with actual data
- Complete example structure (actual output contains ALL real data rows, NO truncation):
undefined⚠️ 关键要求:输出完整性
- 脚本保证输出完整内容:脚本始终输出所有任务,绝不截断
- 始终显示所有行:每一条任务必须逐行列出,无例外
- 绝不使用占位符:不得使用"..."或类似截断符号——展示所有任务的真实数据
- 完整示例结构(实际输出包含所有真实数据行,无截断):
undefined迁移任务
迁移任务
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region1] | [Status1] | [Name1] | [ExpireTime1] | [JobID1] | [CreateTime1] | [InstanceID1] |
| [Region2] | [Status2] | [Name2] | [ExpireTime2] | [JobID2] | [CreateTime2] | [InstanceID2] |
| [Region3] | [Status3] | [Name3] | [ExpireTime3] | [JobID3] | [CreateTime3] | [InstanceID3] |
**The script outputs ALL rows with actual data for EVERY task - NO truncation.**共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region1] | [Status1] | [Name1] | [ExpireTime1] | [JobID1] | [CreateTime1] | [InstanceID1] |
| [Region2] | [Status2] | [Name2] | [ExpireTime2] | [JobID2] | [CreateTime2] | [InstanceID2] |
| [Region3] | [Status3] | [Name3] | [ExpireTime3] | [JobID3] | [CreateTime3] | [InstanceID3] |
**脚本会输出所有任务的完整数据行——无截断。**迁移任务
迁移任务
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
同步任务
同步任务
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
订阅任务
订阅任务
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
Field Definitions:
- 地域: The region where the task resides (in Chinese, e.g., 华东1(杭州)).
- 状态: Task status (e.g., Synchronizing, Completed).
- 任务类型: Mapped to Chinese (迁移, 同步, 订阅).
- 过期时间: Only present for PrePaid instances.
- DTS任务ID: Unique task identifier (DtsJobId).
- DTS实例ID: DTS instance identifier (DtsInstanceID/DtsInstanceId).
- 创建时间: Task creation timestamp (CreateTime).
共 [N] 个
| 地域 | 状态 | DTS任务名称 | 过期时间 | DTS任务ID | 创建时间 | DTS实例ID |
|---|---|---|---|---|---|---|
| [Region] | [Status] | [Name] | [ExpireTime] | [JobID] | [CreateTime] | [InstanceID] |
字段说明:
- 地域: 任务所在的地域(中文,例如:华东1(杭州))。
- 状态: 任务状态(例如:同步中、已完成)。
- 任务类型: 映射为中文(迁移、同步、订阅)。
- 过期时间: 仅预付费实例显示该字段。
- DTS任务ID: 任务唯一标识(DtsJobId)。
- DTS实例ID: DTS实例标识(DtsInstanceID/DtsInstanceId)。
- 创建时间: 任务创建时间戳(CreateTime)。
Workflow
工作流程
- Parse parameters.
- SECURITY & VALIDATION:
- Region Validation: parameter MUST be validated against SUPPORTED_REGIONS whitelist. Invalid regions cause immediate exit with error.
--region - Workers Validation: parameter MUST be within range [1, 32]. Values outside this range cause immediate exit with error.
--workers - API Validation: Attempt a preliminary call. If it returns
describe-dts-jobsor403, immediately halt and report RAM permission issues.400 - Service Enforcement: Strictly forbid calling non-DTS services (e.g., SchedulerX, ECS, FC) for DTS task queries; restrict all calls to the DTS API endpoint only.
- Region Validation:
- PERFORMANCE: Create ThreadPoolExecutor with (default 8).
--workers - Query API for each region/type combo in parallel, injecting and adding
_QueryRegionfor overseas regions.--endpoint - RELIABILITY (Fallback Logic): If fails consecutively 3 times for a specific target, terminate the execution immediately without attempting other DTS interfaces or regions for that target.
describe-dts-jobs - PERFORMANCE: Skip pagination if page 1 returns empty (early exit optimization).
- PERFORMANCE: Use PageSize=200 to minimize API calls (50% reduction vs v10).
- PERFORMANCE: Increased timeout to 10s per API call for reliability (v12.1 - balanced speed/reliability).
- RELIABILITY: Retry failed API calls up to 3 times with exponential backoff (0.2s, 0.4s) for better timeout handling (v12+).
- RELIABILITY: Use Lock for thread-safe data collection (v12).
- RELIABILITY: Validate API responses - only accept those with valid "DtsJobList" field (v12).
- Save raw JSON to .
/tmp/dts_raw_*.json - Read temp file, filter by (PrePaid/PostPaid), then apply user filters.
PayType - Group tasks by type (Migration/Sync/Subscribe), sort each group by CreateTime (newest first).
- Format and print Chinese report with complete task list (NO TRUNCATION).
- Delete temp file.
Output Completeness Guarantee:
- ✅ Script outputs 100% of tasks: The script ALWAYS outputs ALL tasks without truncation
- ✅ Format-ready: The output uses markdown tables ready for direct model response
- ✅ Zero omissions: No tasks are hidden, summarized, or omitted under any circumstances
- ✅ MUST display ALL rows: When using this skill, you MUST output every single task row exactly
- ✅ NO truncation allowed: Never truncate, summarize, or use "..." placeholders
- ✅ Preserve completeness: The script output is COMPLETE - your response MUST be COMPLETE
- ✅ Every task visible: The script outputs EVERY task - your model response MUST show EVERY task
- ✅ No exceptions: Script output = Complete data. Your output MUST = Complete data. ALWAYS.
REMEMBER: The script output is COMPLETE and GUARANTEED. Your model response MUST preserve 100% of it without ANY truncation, summarization, or omission. Display EVERY task row exactly as shown.
- 解析参数。
- 安全与验证:
- 地域验证: 参数必须在SUPPORTED_REGIONS白名单中验证。无效地域将导致立即退出并报错。
--region - 工作线程数验证: 参数必须在[1, 32]范围内。超出范围的值将导致立即退出并报错。
--workers - API验证: 尝试执行一次初步的调用。若返回
describe-dts-jobs或403,立即终止并报告RAM权限问题。400 - 服务限制: 严格禁止调用非DTS服务(例如SchedulerX、ECS、FC)查询DTS任务;所有调用必须限制在DTS API端点。
- 地域验证:
- 性能优化: 创建包含个线程的ThreadPoolExecutor(默认8个)。
--workers - 并行查询每个地域/类型组合,注入字段,并为海外地域添加
_QueryRegion参数。--endpoint - 可靠性(降级逻辑): 若针对某个目标的调用连续失败3次,立即终止执行,不再尝试该目标的其他DTS接口或地域。
describe-dts-jobs - 性能优化: 若第一页返回空结果则跳过分页(提前退出优化)。
- 性能优化: 使用PageSize=200以减少API调用次数(相比v10版本减少50%)。
- 性能优化: 将单次API调用超时时间增加至10秒以提升可靠性(v12.1版本——平衡速度与可靠性)。
- 可靠性: 失败的API调用最多重试3次,采用指数退避(0.2秒、0.4秒)优化超时处理(v12及以上版本)。
- 可靠性: 使用Lock实现线程安全的数据收集(v12版本)。
- 可靠性: 验证API响应——仅接受包含有效"DtsJobList"字段的响应(v12版本)。
- 将原始JSON数据保存至。
/tmp/dts_raw_*.json - 读取临时文件,按(PrePaid/PostPaid)过滤,再应用用户指定的过滤条件。
PayType - 按任务类型(迁移/同步/订阅)分组,每组内按创建时间(最新优先)排序。
- 格式化并打印包含完整任务列表的中文报告(禁止截断)。
- 删除临时文件。
输出完整性保证:
- ✅ 脚本输出100%任务数据:脚本始终输出所有任务,绝不截断
- ✅ 格式就绪:输出使用Markdown表格,可直接作为模型响应
- ✅ 零遗漏:任何情况下都不会隐藏、总结或遗漏任务
- ✅ 必须显示所有行:使用此技能时,必须精确输出每一条任务行
- ✅ 禁止截断:绝不允许截断、总结或使用"..."占位符
- ✅ 保持完整性:脚本输出完整——你的响应必须完整
- ✅ 所有任务可见:脚本输出每一条任务——你的模型响应必须展示每一条任务
- ✅ 无例外:脚本输出=完整数据。你的输出=完整数据,始终如此。
牢记:脚本输出完整且有保证。你的模型响应必须保留100%的内容,不得进行任何截断、总结或遗漏。精确显示每一条任务行内容。