Search code examples
airflow

Apache airflow doens't display the DAG


I'm facing some issues trying to set up a basic DAG file inside the Airflow (but also I have other two files).

I'm using the LocalExecutor through the Ubuntu and saved my files at "C:\Users\tdamasce\Documents\workspace" with the dag and log file inside it.

My script is

# step 1 - libraries

from email.policy import default
from airflow import DAG
from datetime import datetime, timedelta
from airflow.operators.dummy_operator import DummyOperator

# step 2 

default_args = {
    'ownwer': 'airflow',
    'depends_on_past': False,
    'start_date': days_ago(2),
    'retries':0
}

# step 3

dag = DAG(
    dag_id='DAG-1',
    default_args=default_args,
    catchup=False,
    schedule_interval=timedelta(minutes=5)
)

# step 4

start = DummyOperator(
    task_id='start',
    dag=dag
)

end = DummyOperator(
    task_id='end',
    dag=dag
)

My DAG stays like that:

enter image description here

Please, let me know if any add info is needed


Solution

  • As per your updated Question , I can see that you place the DAgs under a directory

    "C:\Users\tdamasce\Documents\workspace" with the dag and log file inside it.

    you need to add dags to dags_folder (specified in airflow.cfg. By default it's $AIRFLOW_HOME/dags subfolder). See if your AIRFLOW_HOME variable and you should found a dag folder there.

    you can also check airflow list_dags - this will list out all the dags,

    Still you are not able to get that in the UI , then restart the servers.