2
respostas

Minha primeira Dag não aparece na interface web, verifiquei alguns erros no terminal após ativar o standalone

Segue os erros que aparecem no terminal:

standalone | Airflow is ready standalone | Login with username: admin password: PR69yHngQGEnwywn standalone | Airflow Standalone is for development purposes only. Do not use this in production! standalone | webserver | [2023-01-30 23:28:09,952] {manager.py:508} INFO - Created Permission View: menu access on Permissions webserver | [2023-01-30 23:28:10,008] {manager.py:568} INFO - Added Permission menu access on Permissions to role Admin webserver | [2023-01-30 23:28:10,017] {manager.py:570} ERROR - Add Permission to Role Error: (sqlite3.IntegrityError) UNIQUE constraint failed: ab_permission_view_role.permission_view_id, ab_permission_view_role.role_id webserver | [SQL: INSERT INTO ab_permission_view_role (permission_view_id, role_id) VALUES (?, ?)] webserver | [parameters: (184, 1)] webserver | (Background on this error at: http://sqlalche.me/e/14/gkpj) webserver | /home/fabricio/Documents/airflowalura/venv/lib/python3.9/site-packages/airflow/api_connexion/schemas/task_instance_schema.py:63 RemovedInMarshmallow4Warning: The 'default' argument to fields is deprecated. Use 'dump_default' instead. webserver | /home/fabricio/Documents/airflowalura/venv/lib/python3.9/site-packages/airflow/api_connexion/schemas/task_instance_schema.py:63 RemovedInMarshmallow4Warning: The 'default' argument to fields is deprecated. Use 'dump_default' instead. webserver | /home/fabricio/Documents/airflowalura/venv/lib/python3.9/site-packages/airflow/api_connexion/schemas/task_instance_schema.py:63 RemovedInMarshmallow4Warning: The 'default' argument to fields is deprecated. Use 'dump_default' instead. webserver | /home/fabricio/Documents/airflowalura/venv/lib/python3.9/site-packages/airflow/api_connexion/schemas/task_instance_schema.py:63 RemovedInMarshmallow4Warning: The 'default' argument to fields is deprecated. Use 'dump_default' instead. webserver | 127.0.0.1 - - [30/Jan/2023:23:31:50 -0300] "GET /home HTTP/1.1" 200 282101 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" webserver | 127.0.0.1 - - [30/Jan/2023:23:31:53 -0300] "POST /blocked HTTP/1.1" 200 2 "http://localhost:8080/home" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" webserver | 127.0.0.1 - - [30/Jan/2023:23:31:53 -0300] "POST /dag_stats HTTP/1.1" 200 10614 "http://localhost:8080/home" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" webserver | 127.0.0.1 - - [30/Jan/2023:23:31:53 -0300] "POST /last_dagruns HTTP/1.1" 200 2 "http://localhost:8080/home" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" webserver | 127.0.0.1 - - [30/Jan/2023:23:31:53 -0300] "POST /task_stats HTTP/1.1" 200 37305 "http://localhost:8080/home" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" scheduler | [2023-01-30 23:33:06,131] {scheduler_job.py:1221} INFO - Resetting orphaned tasks for active dag runs


2 respostas

Boa tarde!

Gostaria de relatar que talvez eu tenha um problema similar! Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Ao iniciar o DAG, depois de debuggar e iniciar no terminal o airflow, me deparo com o erro acima.

Tive que relizar uma correção no codigo onde, relizei a mudança do comando days_ago, creio que nao mais disponível.

SEgue abaixo o codigo utilizado:

from airflow.models import dag
from datetime import datetime
from airflow.operators.empty import EmptyOperator
from airflow.operators.bash import BashOperator
with dag(
    'meu_primeiro_dag',
    start_date = datetime(2023, 1, 1),
    schedule_interval= '@daily',
    tags = ['alura','teste'],
) as dag:
    tarefa_1 = EmptyOperator(task_id= 'tarefa_1')
    tarefa_2 = EmptyOperator(task_id= 'tarefa_2')
    tarefa_3 = EmptyOperator(task_id= 'tarefa_3')
    tarefa_4 = BashOperator(
        task_id = 'cria_pasta'
        bash_command= 'mkdir -p "/home/bruno/Documents/airflowalura/pasta" '
    )
tarefa_1 >> [tarefa_2,tarefa_3]
tarefa_3 >> tarefa_4

Poderiam me auxliar?

Olá Bruno, Pelo que parece você tem um erro de sintaxe na linha:

bash_command= 'mkdir -p "/home/bruno/Documents/airflowalura/pasta" '

Eu acho que provavelmente por causa que você esta passando aspas duplas dentro das aspas simples.

Tente somente: "mkdir -p /home/bruno/Documents/airflowalura/pasta"