Depuração e troubleshooting no Airflow

Introdução ao Apache Airflow em Python

Mike Metzger

Data Engineer

Problemas típicos...

  • DAG não executa no agendamento
  • DAG não carrega
  • Erros de sintaxe
Introdução ao Apache Airflow em Python

DAG não executa no agendamento

  • Verifica se o scheduler está rodando

Scheduler do Airflow não está rodando

  • Corrige rodando airflow scheduler no terminal.
Introdução ao Apache Airflow em Python

DAG não executa no agendamento (parte 2)

  • Pelo menos um schedule_interval ainda não passou.
    • Ajusta os atributos ao que você precisa.
  • Faltam tasks livres no executor para rodar.
    • Troca o tipo de executor
    • Adiciona recursos de sistema
    • Adiciona mais máquinas
    • Ajusta o agendamento do DAG
Introdução ao Apache Airflow em Python

DAG não carrega

  • DAG não aparece na web UI
  • DAG não aparece em airflow dags list

Possíveis soluções

  • Confirma que o arquivo do DAG está na pasta certa
  • Veja a pasta de DAGs em airflow.cfg
  • A pasta deve ser um caminho absoluto

Airflow dags_folder

Introdução ao Apache Airflow em Python

Erros de sintaxe

  • Motivo mais comum de um DAG não aparecer
  • Às vezes é difícil achar erros no DAG
  • Duas formas rápidas:

    • Rodar airflow dags list-import-errors

    • Rodar python3 <dagfile.py>

Introdução ao Apache Airflow em Python

airflow dags list-import-errors

airflow dags list-import-errors com erros

Introdução ao Apache Airflow em Python

Executando o interpretador Python

python3 dagfile.py:

  • Com erros

python3 - errors

  • Sem erros

python3 - no errors

Introdução ao Apache Airflow em Python

Vamos praticar!

Introdução ao Apache Airflow em Python

Preparing Video For Download...