当前位置: 首页 > Skill >

AI-powered DP Platform Operations Advisor

AI-powered DP Platform Operations Advisor

2.0.1 2026.11.25 浏览:425
获取Skill文件查看使用说明
作者:沈舟许可证:
本文目录展开

dp-ops-advisor

Purpose

Monitor, diagnose, and advise on DP Data Processing Platform job operations. This skill provides intelligent operational support: checking job health, interpreting metrics, diagnosing failures, suggesting fixes, and generating incident reports.

Environment Configuration

The DP platform runs at ${DP_SERVER_URL}.

Required environment variables:

 DP_SERVER_URL=${DP_SERVER_URL}   # REQUIRED — DP platform base URL
DP_API_KEY=${DP_API_KEY}         # REQUIRED — obtain from platform「API Key 管理」page

ALL curl commands MUST use -H 'X-DP-API-Key: ${DP_API_KEY}'. No other authentication method is supported.

首次使用引导

# 校验 DP_API_KEY — 未配置则终止
if [ -z "${DP_API_KEY}" ]; then
  echo "======================================"
  echo "  DP Platform — API Key 必填"
  echo "======================================"
  echo "错误:未检测到 DP_API_KEY,无法继续。"
  echo ""
  echo "请按以下步骤配置:"
  echo "1. 访问 DP 平台控制台:${DP_SERVER_URL}"
  echo "2. 注册账号(如需邀请码请联系管理员)"
  echo "3. 进入「API Key 管理」→「申请新 Key」"
  echo "4. 将生成的 Key 配置到 DP_API_KEY 环境变量"
  echo ""
  echo "免费版:100次/月。超额后需升级订阅套餐。"
  echo "======================================"
  exit 1
fi
echo "API Key 已验证:${DP_API_KEY:0:8}****"

配额说明

  • 免费版:100 次/月 API 调用额度
  • 超额时响应中会包含 quota_exceeded: true 字段
  • 响应中的 upgrade_url 字段指向订阅升级页面
  • 升级套餐可获得更多额度:BASIC(1000次)、PRO(10000次)、ENTERPRISE(不限)

Capabilities

  • Real-time health check of all jobs (running/failed/stalled)
  • Per-operator throughput and latency analysis
  • Failure root-cause analysis from error logs
  • Auto-restart policy evaluation and execution
  • Stall detection (job running but no data flowing)
  • Historical run trend analysis
  • Generate incident report summaries
  • Recommend configuration tuning based on observed metrics

Context Files

File Purpose
dp-api-reference.md REST API endpoints for status, logs, progress
dp-operator-catalog.json Operator descriptions to contextualize metrics

Prerequisites Check

# Verify DP Server connectivity
curl -s --connect-timeout 3 ${DP_SERVER_URL}/homepage && echo "DP Server OK" || echo "DP Server NOT running"

# Auth: API Key is REQUIRED — no session fallback allowed
if [ -z "${DP_API_KEY}" ]; then
  echo "ERROR: DP_API_KEY is not set. Please configure DP_API_KEY environment variable."
  exit 1
fi
AUTH="-H 'X-DP-API-Key: ${DP_API_KEY}'"
echo "Auth: API Key mode (${DP_API_KEY:0:8}****)"

Workflow

Mode 1: Platform Health Check (全局健康检查)

Triggered when user says: "检查平台状态" / "哪些作业有问题" / "平台健不健康"

# Get all job statuses
ALL_STATUS=$(curl -H "X-DP-API-Key: ${DP_API_KEY}" -s "${DP_SERVER_URL}/job/status")

# Parse and categorize
echo "$ALL_STATUS" | python3 -c "
import sys, json
jobs = json.load(sys.stdin)

running = [j for j in jobs if j.get('state') == 'RUNNING']
failed  = [j for j in jobs if j.get('state') == 'FAILED']
stoping = [j for j in jobs if j.get('state') == 'STOPING']
waiting = [j for j in jobs if j.get('state') == 'Waiting']
finished= [j for j in jobs if j.get('state') == 'FINISHED']
idle    = [j for j in jobs if not j.get('state')]

print('=== DP Platform Health Report ===')
print(f'Total jobs: {len(jobs)}')
print(f'  RUNNING  : {len(running)}')
print(f'  FAILED   : {len(failed)}')
print(f'  FINISHED : {len(finished)}')
print(f'  WAITING  : {len(waiting)}')
print(f'  IDLE     : {len(idle)}')
print()

if failed:
    print('!! FAILED JOBS (need attention):')
    for j in failed:
        print(f'   - {j.get("jobID","?")} | {j.get("state")}')
    print()

if running:
    print('OK RUNNING JOBS:')
    for j in running:
        print(f'   - {j.get("jobID","?")}')
"

After health check, proactively:

  • For each FAILED job: offer to diagnose (Mode 3)
  • For each RUNNING job: offer to check throughput (Mode 2)

Mode 2: Job Throughput Analysis (吞吐量分析)

Triggered when user says: "看一下 [job] 的运行情况" / "数据有没有在流动" / "作业跑的快不快"

JOB_ID="$1"  # job ID from user or from health check

# Get per-operator metrics
PROGRESS=$(curl -H "X-DP-API-Key: ${DP_API_KEY}" -s "${DP_SERVER_URL}/job/progress?id=$JOB_ID")

echo "$PROGRESS" | python3 -c "
import sys, json
data = json.load(sys.stdin)
print(f'Job: {data["name"]} (ID: {data["id"]})')
print(f'Path: {data.get("path","")}')
print()
print(f'{'Operator':<30} {'Status':<12} {'Records In':<15} {'Records Out':<15} {'Speed(rec/s)':<15} {'ByteSpeed':<12}')
print('-' * 100)
for op in data.get('data', []):
    status = op.get('status', '-')
    r_in   = op.get('recordsRead', '-')
    r_out  = op.get('recordsWritten', '-')
    speed  = op.get('speed', '-')
    bspeed = op.get('byteSpeed', '-')
    name   = op.get('name', op.get('id', '?'))[:28]
    
    # Flag potential stall: speed=0 but status=RUNNING
    flag = ' !! STALLED?' if status == 'RUNNING' and speed == '0' else ''
    print(f'{name:<30} {status:<12} {r_in:<15} {r_out:<15} {speed:<15} {bspeed:<12}{flag}')
"

Stall Detection Logic:

A job is stalled if:

  • status = RUNNING but speed = 0 AND recordsRead has not changed over 2 consecutive checks

When stall detected:

# Take two readings 30 seconds apart and compare recordsRead
PROG1=$(curl -H "X-DP-API-Key: ${DP_API_KEY}" -s "${DP_SERVER_URL}/job/progress?id=$JOB_ID")
sleep 30
PROG2=$(curl -H "X-DP-API-Key: ${DP_API_KEY}" -s "${DP_SERVER_URL}/job/progress?id=$JOB_ID")

python3 -c "
import sys, json
p1 = json.loads('$PROG1')
p2 = json.loads('$PROG2')
ops1 = {op['id']: op for op in p1.get('data',[])}
ops2 = {op['id']: op for op in p2.get('data',[])}
print('Stall detection (30s interval):')
for pid, op2 in ops2.items():
    op1 = ops1.get(pid, {})
    r1 = op1.get('recordsRead','0')
    r2 = op2.get('recordsRead','0')
    if r1 == r2 and op2.get('status') == 'RUNNING':
        print(f'  STALLED: {op2.get("name",pid)} - records unchanged at {r2}')
    else:
        delta = str(int(r2 or 0) - int(r1 or 0)) if r1 != '-' and r2 != '-' else '?'
        print(f'  OK: {op2.get("name",pid)} - processed +{delta} records')
"

Response Format

Always structure responses with:

[Health]: Overall platform/job status

[Findings]: Specific issues identified

[Diagnosis]: Root cause analysis

[Actions]: What was done or should be done

[Status]: Current state after any actions

Limitations & Guardrails

  1. Never auto-restart without user confirmation in production scenarios.
  2. Never modify job configurations — only report and advise (use dp-pipeline-designer skill to make changes).
  3. Do not expose raw stack traces to non-technical users — summarize the error in plain language.
  4. If DP Server is unreachable, guide user to check and start services. Provide the startup command.
  5. Session refresh: If API returns "Authentication required", automatically re-login before retrying.

相关文章

更多
Linux内核字符设备驱动核心机制与开发流程

本文梳理Linux内核中字符设备驱动的核心实现机制。字符设备以字节流方式访问,通过主设备号标识驱动、次设备号区分实例。开发流程涵盖使用alloc_chrdev_region动态分配设备号、初始化struct cdev并调用cdev_add注册到内核。重点解析file_operations、file和inode三大数据结构的作用,以及open/release生命周期管理。针对read/write操作,强调必须使用copy_to_user等安全函数在用户态与内核态间交换数据,避免直接指针访问引发的架构兼容性与安全性问题。

2026.09.03 245
Skill 文件
  • SKILL.md
    • dp-ops-advisor
    • Purpose
    • Environment Configuration
    • 首次使用引导
    • 配额说明
    • Capabilities
    • Context Files
    • Prerequisites Check
    • Workflow
      • Mode 1: Platform Health Check (全局健康检查)
      • Mode 2: Job Throughput Analysis (吞吐量分析)
    • Response Format
    • Limitations & Guardrails
  • 项目或源文件

相关 Skill

更多
Landscaping & Lawn Care Operations Landscaping & Lawn Care Operations 园林绿化及草坪护理业务运营、定价、路线规划、团队管理、合规与收入增长策略顾问
VMware AIops VMware AIops Use this skill whenever the user needs to manage VMs in VMware/vSphere/ESXi — it's the entry point for all VM operations. Directly handles: power on/off, clone, snapshot, migrate, deploy from OVA or templates, run commands inside VMs, batch operations, cluster management, vCenter alarm acknowledgment, a one-glance cluster-health triage ("is anything on fire?"), and VM/host/datastore investigation drill-downs. Always use this skill for any "power on", "clone", "deploy", "migrate", "batch", "guest
Pest Control Business Operations Pest Control Business Operations 提供有关许可、EPA合规、定价、路线优化、技术人员管理、季节性规划及害虫防治业务增长策略的专家指导。
Kansodata Grafana Authoring Operations Kansodata Grafana Authoring Operations 安全地检查、诊断、提出并受控地应用 Grafana 仪表板和告警的更改,使用已启用的工具。
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.