airflow icon indicating copy to clipboard operation
airflow copied to clipboard

can not find dag_id when using backfill and specify subdir

Open adadle opened this issue 11 years ago • 7 comments

when I run: airflow backfill -sd /home/prod/tony/dag_test -s 2015-08-20 -e 2015-08-21 tutorial. the python code http://airflow.readthedocs.org/en/latest/tutorial.html StackTrace log: Traceback (most recent call last): File "/usr/local/bin/airflow", line 10, in args.func(args) File "/usr/local/lib/python2.7/site-packages/airflow/bin/cli.py", line 93, in run raise AirflowException(msg) airflow.utils.AirflowException: DAG [tutorial] could not be found

adadle avatar Aug 25 '15 11:08 adadle

Can I ask which version of airflow you are using?

I remember hitting a similar bug that I fixed by 1) upgrading my version of airflow to the latest 2) Making sure that my AIRFLOW_HOME was set correctly and that the DAGS_FOLDER was correctly entered in my airflow.cfg file.

artwr avatar Aug 25 '15 15:08 artwr

Both are setted in airflow.cfg, what I want to say is I'm running by sepecified subdir. Thanks for your reply.

adadle avatar Aug 26 '15 09:08 adadle

I'm having the same issue. When I specify -sd /mytest_dags/ it works for the "test", "list_dags", "list_tasks" commands, but for backfill there are some complications:

  1. First it initially finds my job and knows how many tasks to run, etc. 2015-08-31 10:04:12,802 INFO - Filling up the DagBag from /mytestdags 2015-08-31 10:04:12,803 INFO - Importing /mytestdags/example_hive_job.py 2015-08-31 10:04:12,805 INFO - Loaded DAG <DAG: example_hive_job> 2015-08-31 10:04:13,011 INFO - Adding to queue: airflow run example_hive_job waitfor_for_hdfs 2015-08-26T00:00:00 --local -sd DAGS_FOLDER//mytestdags/example_hive_job.py -s 2015-08-26T00:00:00 2015-08-31 10:04:18,020 INFO - [backfill progress] waiting: 3 | succeeded: 0 | kicked_off: 1 | failed: 0 | skipped: 0

  2. When it runs each task though, it runs it apparently by prepending the "DAGS_FOLDER" as follows: Adding to queue: airflow run example_hive_job waitfor_for_hdfs 2015-08-26T00:00:00 --local -sd DAGS_FOLDER//mytestdags/example_hive_job.py -s 2015-08-26T00:00:00

  3. This fails with an error: airflow.utils.AirflowException: DAG [example_hive_job] could not be found

cgelman avatar Aug 31 '15 17:08 cgelman

Also, using Airflow version: v1.5.0

cgelman avatar Aug 31 '15 17:08 cgelman

I've ran into similar issue with 1.5.2 and was able to resolve by adding the --ship_dag switch on the CLI. I've also seen the same error when AIRFLOW_HOME environment variable hasn't been set.

jeffhoek avatar Nov 03 '15 16:11 jeffhoek

I guess this error happens because dags_folder contains '/' at the end of the folder, try to remove '/' at the end of config. example:

wrong: /home/user/airflow/dags/ right: /home/user/airflow/dags

ariepratama avatar Feb 18 '16 05:02 ariepratama

@tonylee0329 I know this is an old issue but I just came across it and I think I put a fix for this in #1271

jlowin avatar Apr 04 '16 02:04 jlowin