You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/19 15:34:02 UTC

[GitHub] [airflow] eladkal commented on issue #17585: New Tasks to an existing DAG do not get scheduled if they have depends_on_past = True

eladkal commented on issue #17585:
URL: https://github.com/apache/airflow/issues/17585#issuecomment-902014936


   > Add another task with depends_on_past=True to the existing DAG
   
   I think the issue here is that you assume that when you add a new task Airflow knows that it starts from the date you added it thus you expect depends_on_past=True to work but this is not the case. You must provide a `start_date` to this new task then it will work as expected.
   
   ```
   from airflow import DAG
   from airflow.operators.dummy import DummyOperator
   from datetime import datetime
   
   default_args = {
       'owner': 'Elad',
       'start_date': datetime(2021, 8, 19),
   }
   
   with DAG('my_dag2', default_args=default_args, schedule_interval='*/5 * * * *') as dag:
       a = DummyOperator(task_id="1st")
       b = DummyOperator(task_id="2nd", wait_for_downstream=True)
       a >> b
   
   with DAG('my_dag3', default_args=default_args, schedule_interval='*/5 * * * *') as dag:
       a = DummyOperator(task_id="1st")
       b = DummyOperator(task_id="2nd", wait_for_downstream=True, start_date=datetime(2021, 8, 19, 15, 15))
       a >> b
   ```
   
   as you can see `my_dag3` works fine yet `my_dag2` is stuck:
   
   ![Screen Shot 2021-08-19 at 18 29 18](https://user-images.githubusercontent.com/45845474/130097259-52b79d35-0186-446e-a668-aa12f145c642.png)
   
   ![Screen Shot 2021-08-19 at 18 29 11](https://user-images.githubusercontent.com/45845474/130097294-7996b42f-2b24-4db3-abcc-486f15e86f51.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org