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/01/14 08:01:42 UTC

[GitHub] [airflow] vxtals commented on issue #13434: Airflow 2.0.0 manual run causes scheduled run to skip

vxtals commented on issue #13434:
URL: https://github.com/apache/airflow/issues/13434#issuecomment-760003219


   I don't think this is really a bug but a change of behavior, IMO this should be reversed or at least allow to change it through config. 
   
   The problem is in the method bulk_write_to_db in the class DAG [https://github.com/apache/airflow/blob/master/airflow/models/dag.py](url)
   
           # Get the latest dag run for each existing dag as a single query (avoid n+1 query)
           most_recent_dag_runs = dict(
               session.query(DagRun.dag_id, func.max_(DagRun.execution_date))
               .filter(
                   DagRun.dag_id.in_(existing_dag_ids),
                   or_(
                       DagRun.run_type == DagRunType.BACKFILL_JOB,
                       DagRun.run_type == DagRunType.SCHEDULED,
                       DagRun.external_trigger.is_(True),
                   ),
               )
               .group_by(DagRun.dag_id)
               .all()
           )
   
   When is getting from db 'most_recent_dag_runs' it includes DagRun.external_trigger.is_(True).
   This most_recent_dag_runs is used later in the method to calculate the next execution, so if it finds a manually triggered execution in the current schedule interval it won't schedule the execution. By removing that line it goes back to previous versions behavior.
   
   


----------------------------------------------------------------
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.

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