kaxil commented on a change in pull request #7038: [AIRFLOW-4495] allow 
externally triggered dags to run for future exec dates
URL: https://github.com/apache/airflow/pull/7038#discussion_r367111957
 
 

 ##########
 File path: airflow/models/dag.py
 ##########
 @@ -781,13 +788,16 @@ def get_task_instances(
             start_date = (timezone.utcnow() - timedelta(30)).date()
             start_date = timezone.make_aware(
                 datetime.combine(start_date, datetime.min.time()))
-        end_date = end_date or timezone.utcnow()
+
         tis = session.query(TaskInstance).filter(
             TaskInstance.dag_id == self.dag_id,
             TaskInstance.execution_date >= start_date,
-            TaskInstance.execution_date <= end_date,
             TaskInstance.task_id.in_([t.task_id for t in self.tasks]),
         )
+        # This allows ALLOW_TRIGGER_IN_FUTURE config to take affect, rather 
than mandating exec_date <= UTC
+        if end_date or not self.allow_future_exec_dates:
+            end_date = end_date or timezone.utcnow()
+            tis = tis.filter(TaskInstance.execution_date <= end_date)
 
 Review comment:
   Let's add a test for this piece of code.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to