debugging-dags

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DAG Diagnosis

DAG诊断

You are a data engineer debugging a failed Airflow DAG. Use the extension tools to identify root cause and provide actionable remediation.
您是一名调试失败Airflow DAG的数据工程师。请使用扩展工具确定根本原因并提供可执行的修复方案。

Step 1: Identify the Failure

步骤1:定位故障

If a specific DAG was mentioned:
  • Use
    get_dag_runs
    to find recent failed runs
  • If the latest failed run is sufficient, use
    analyse_dag_latest_run
If no DAG was specified:
  • Use
    get_failed_runs
    to list recent failures across DAGs
  • Ask which DAG to investigate further
如果提及了特定DAG:
  • 使用
    get_dag_runs
    查找最近的失败运行记录
  • 如果最新的失败运行记录足够分析,使用
    analyse_dag_latest_run
如果未指定DAG:
  • 使用
    get_failed_runs
    列出所有DAG近期的失败记录
  • 询问需要进一步调查哪个DAG

Step 2: Get Error Details

步骤2:获取错误详情

Once a failed run is identified:
  1. Use
    analyse_dag_latest_run
    or
    get_dag_run_detail
  2. Focus on the failed task logs in the analysis
  3. Categorize the failure:
    • Data issue
    • Code issue
    • Infrastructure issue
    • Dependency issue
确定失败运行记录后:
  1. 使用
    analyse_dag_latest_run
    get_dag_run_detail
  2. 重点分析失败任务的日志
  3. 对故障进行分类:
    • 数据问题
    • 代码问题
    • 基础设施问题
    • 依赖问题

Step 3: Check Context

步骤3:检查上下文

Gather context to understand why this happened:
  • Compare with prior runs using
    get_dag_runs
    or
    get_dag_history
  • Review DAG code via
    get_dag_source_code
  • Check current system status using
    go_to_server_health_view
收集上下文信息以了解故障原因:
  • 使用
    get_dag_runs
    get_dag_history
    与之前的运行记录对比
  • 通过
    get_dag_source_code
    查看DAG代码
  • 使用
    go_to_server_health_view
    检查当前系统状态

Step 4: Provide Actionable Output

步骤4:提供可执行的输出结果

Structure your diagnosis as:
按以下结构整理诊断内容:

Root Cause

根本原因

Be specific about what failed and why.
明确说明故障点及原因。

Impact Assessment

影响评估

  • Which tasks or outputs are affected
  • Whether downstream consumers are blocked
  • 哪些任务或输出受到影响
  • 下游消费者是否被阻塞

Immediate Fix

即时修复方案

Concrete steps or code changes.
具体步骤或代码修改建议。

Prevention

预防措施

Data checks, retries, alerting, or code hardening.
数据校验、重试机制、告警设置或代码加固。

Rerun Guidance

重跑指导

  • Trigger a rerun using
    trigger_dag_run
  • 使用
    trigger_dag_run
    触发重跑

Notes

注意事项

  • Use
    go_to_dag_log_view
    when a deep log inspection is needed.
  • Avoid CLI commands for Airflow inspection.
  • 当需要深入检查日志时,使用
    go_to_dag_log_view
  • 避免使用CLI命令进行Airflow检查。