Silent failure when running airflow db init
#18408
Replies: 3 comments 10 replies
-
Not sure if I understand the issue correctly, but the error "invalid command 'db'" suggests to me you're running |
Beta Was this translation helpful? Give feedback.
-
Maybe for some reason you installed Airlfow 1.10 over Airflow 2? For example if you try to install backport-providers, they are Airflow 1.10-only and when you install them from requirements, they will DOWNGRADE your airflow to 1.10.... |
Beta Was this translation helpful? Give feedback.
-
I think I saw it before. I can't remember the details, but I am quite sure that one of your dags likely has some code that it should not suppose to run. I saw sometimes when people used to run their dags to test their DAGs as python code and added some code at the end of DAG that should never be run when DAGs are parsed by Airflow (this is what happens - your upgrade is actually parsing some DAGs). What helped in that case was putting the code under:
|
Beta Was this translation helpful? Give feedback.
-
Hey folks,
I've come across an issue where when attempting to run migrations against a clean database, but with existing dags defined in my dags folder, there's a silent failure and the migration exits with the
airflow
command usage prompt saying "invalid command 'db'".I got to digging and the culprit was the following line.
I'm almost positive that this has to do with an erroneous
.py
file in my dags folder (I have yet to dig deeper into the issue), but this begged the question of why is the migration is reading the dags to migrate existing data in the database in the first place? Shouldn't the migration simply migrate the data regardless of the state of the dag files themselves?I was able to fix the issue by changing the line in the link above to
dagbag = DagBag(read_dags_from_db=True)
but I'd like to see if there was any context behind reading the dag file instead of the database before opening a PR.Beta Was this translation helpful? Give feedback.
All reactions