Airflow DAG not getting scheduled -


i new airflow , created first dag. here dag code. want dag start , thereafter run once in day.

from airflow import dag airflow.operators.bash_operator import bashoperator datetime import datetime, timedelta  default_args = {     'owner': 'airflow',     'depends_on_past': false,     'start_date': datetime.now(),     'email': ['aaaa@gmail.com'],     'email_on_failure': false,     'email_on_retry': false,     'retries': 1,     'retry_delay': timedelta(minutes=5), }  dag = dag(     'alamode', default_args=default_args, schedule_interval=timedelta(1))  create_command = "/home/ubuntu/scripts/makedir.sh "  # t1 task invoke directory creation shell script t1 = bashoperator(     task_id='create_directory',     bash_command=create_command,     dag=dag)  run_spiders = "/home/ubuntu/scripts/crawl_spiders.sh " # t2 task invoke spiders t2 = bashoperator(     task_id='web_scrawl',     bash_command=run_spiders,     dag=dag)  # set dependency between tasks. 't1' should run before t2 t2.set_upstream(t1) 

the dag not getting picked airflow. checked log , here says.

[2017-09-12 18:08:20,220] {jobs.py:343} dagfileprocessor398 info - started process (pid=7001) work on /home/ubuntu/airflow/dags/alamode.py [2017-09-12 18:08:20,223] {jobs.py:1521} dagfileprocessor398 info - processing file /home/ubuntu/airflow/dags/alamode.py tasks queue [2017-09-12 18:08:20,223] {models.py:167} dagfileprocessor398 info - filling dagbag /home/ubuntu/airflow/dags/alamode.py [2017-09-12 18:08:20,262] {jobs.py:1535} dagfileprocessor398 info - dag(s) ['alamode'] retrieved /home/ubuntu/airflow/dags/alamode.py [2017-09-12 18:08:20,291] {jobs.py:1169} dagfileprocessor398 info - processing alamode /usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/default_comparator.py:161: sawarning: in-predicate on "dag_run.dag_id" invoked empty sequence. results in contradiction, nonetheless can expensive evaluate.  consider alternative strategies improved performance.   'strategies improved performance.' % expr) [2017-09-12 18:08:20,317] {models.py:322} dagfileprocessor398 info - finding 'running' jobs without recent heartbeat [2017-09-12 18:08:20,318] {models.py:328} dagfileprocessor398 info - failing jobs without heartbeat after 2017-09-12 18:03:20.318105 [2017-09-12 18:08:20,320] {jobs.py:351} dagfileprocessor398 info - processing /home/ubuntu/airflow/dags/alamode.py took 0.100 seconds 

what doing wrong? have tried changing schedule_interval schedule_interval=timedelta(minutes=1) see if starts immediately, still no use. can see tasks under dag expected in airflow ui schedule status 'no status'. please me here.

this issue has been resolved following below steps:

1) used older date start_date , schedule_interval=timedelta(minutes=10). also, used real date instead of datetime.now().
2) added catchup = true in dag arguments.
3) setup environment variable export airflow_home=pwd/airflow_home.
4) deleted airflow.db
5) moved new code dags folder
6) ran command 'airflow initdb' create db again.
7) turned 'on' switch of dag through ui
8) ran command 'airflow scheduler'

here code works now:

from airflow import dag airflow.operators.bash_operator import bashoperator datetime import datetime, timedelta  default_args = {     'owner': 'airflow',     'depends_on_past': false,     'start_date': datetime(2017, 9, 12),     'email': ['anjana@gapro.tech'],     'retries': 0,     'retry_delay': timedelta(minutes=15) }  dag = dag(     'alamode', catchup=false, default_args=default_args, schedule_interval="@daily")  # t1 task invoke directory creation shell script t1 = bashoperator(     task_id='create_directory',     bash_command='/home/ubuntu/scripts/makedir.sh ',     dag=dag)   # t2 task invoke spiders t2 = bashoperator(     task_id= 'web_crawl',     bash_command='/home/ubuntu/scripts/crawl_spiders.sh ',     dag=dag)  # set dependency between tasks. 't1' should run before t2 t2.set_upstream(t1) 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -