question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New dags fail to run

See original GitHub issue

Apache Airflow version: 1.10.9

Kubernetes version (if you are using kubernetes) (use kubectl version): N/A

Environment: JupyterLab docker image, Ubuntu 18.04 VM

  • Cloud provider or hardware configuration: Microsoft Azure

  • OS (e.g. from /etc/os-release): Ubuntu 18.04

  • Kernel (e.g. uname -a): Linux <name> 5.0.0-1032-azure #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Install tools: apache-airflow

  • Others: What happened: On a fresh install of airflow, I run airflow initdb, and then create a dag (bash.py)

from datetime import datetime
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from datetime import timedelta
import airflow

start_date = datetime(2020, 1, 1)

args={'owner': 'cccs-cat001', 'start_date': start_date}

dag = DAG(dag_id='date', default_args=args, schedule_interval=timedelta(minutes=5), dagrun_timeout=timedelta(minutes=60))

run_dag = BashOperator(task_id='show_date', bash_command='date', dag=dag)

for i in range(5):
        task = DummyOperator(task_id='dummy_'+str(i), dag=dag)
        task.set_upstream(run_dag)

and then airflow list_dags will show that the dag exists, and if you run airflow trigger_dag date it will give you the following error

Traceback (most recent call last):
  File "/home/artifactory/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/home/artifactory/.local/lib/python3.6/site-packages/airflow/utils/cli.py", line 75, in wrapper
    return f(*args, **kwargs)
  File "/home/artifactory/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 237, in trigger_dag
    execution_date=args.exec_date)
  File "/home/artifactory/.local/lib/python3.6/site-packages/airflow/api/client/local_client.py", line 34, in trigger_dag
    execution_date=execution_date)
  File "/home/artifactory/.local/lib/python3.6/site-packages/airflow/api/common/experimental/trigger_dag.py", line 124, in trigger_dag
    raise DagNotFound("Dag id {} not found in DagModel".format(dag_id))
airflow.exceptions.DagNotFound: Dag id bash not found in DagModel

And it won’t run. Now run airflow initdb and then trigger the dag again, and it works fine.

What you expected to happen: Should just be able to run the dag without initializing the db again…

How to reproduce it: see above

Anything else we need to know: The other version we’re running is 1.10.5, and this issue doesn’t seem to happen there. Once you run airflow initdb after the dag, it’ll run always. But add a new dag and trigger it and the same thing occurs.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cccs-cat001commented, Mar 26, 2020

I see. So that same behavior does happen in 1.10.5. If the scheduler is running it works fine, the scheduler must add it to the db for me? With that said, I think it’d be nice if the error message reminded you to be running the scheduler or something like that. Just a thought.

0reactions
NeoWang9999commented, Aug 27, 2020

I agreed with cat buddy, the error message is not clear what is going on really.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Common Errors to Check When Debugging Airflow DAGs
1. Your DAG Isn't Running at the Expected Time · Airflow's Schedule Interval · Use Timetables for Simpler Scheduling · Airflow Time Zones....
Read more >
Airflow: how to stop next dag run from starting after failure
One way you can do this is add a cleanup task to the start of your dag, which can check whether resources were...
Read more >
Troubleshooting DAGs | Cloud Composer
In the Airflow web interface, check in the DAG's Graph View for failed task instances. Tip: To navigate through a large DAG to...
Read more >
DAG Runs — Airflow Documentation
The status is assigned to the DAG Run when all of the tasks are in the one of the terminal states (i.e. if...
Read more >
DAGs, Operators, Connections, and other issues in Apache ...
I see a 'The scheduler does not appear to be running' error ... your DAGs may not appear in Apache Airflow, and new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found