You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/04/05 07:58:03 UTC

incubator-airflow git commit: [AIRFLOW-1001] Fix landing times if there is no following schedule

Repository: incubator-airflow
Updated Branches:
  refs/heads/master f1bc5f38a -> 0371df4f1


[AIRFLOW-1001] Fix landing times if there is no following schedule

@once does not have a following schedule. This was
not checked for
and therefore the landing times page could bork.

Closes #2213 from bolkedebruin/AIRFLOW-1001


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/0371df4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/0371df4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/0371df4f

Branch: refs/heads/master
Commit: 0371df4f1bd78e220e591d5cb23630d6a062f109
Parents: f1bc5f3
Author: Bolke de Bruin <bo...@xs4all.nl>
Authored: Wed Apr 5 09:57:55 2017 +0200
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Wed Apr 5 09:57:55 2017 +0200

----------------------------------------------------------------------
 airflow/www/views.py |  2 +-
 tests/core.py        | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/0371df4f/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 3973866..0194e58 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1573,7 +1573,7 @@ class Airflow(BaseView):
             for ti in task.get_task_instances(session, start_date=min_date,
                                               end_date=base_date):
                 ts = ti.execution_date
-                if dag.schedule_interval:
+                if dag.schedule_interval and dag.following_schedule(ts):
                     ts = dag.following_schedule(ts)
                 if ti.end_date:
                     dttm = wwwutils.epoch(ti.execution_date)

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/0371df4f/tests/core.py
----------------------------------------------------------------------
diff --git a/tests/core.py b/tests/core.py
index a6bf613..353b847 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -1586,6 +1586,7 @@ class WebUiTests(unittest.TestCase):
         self.dag_bash2 = self.dagbag.dags['test_example_bash_operator']
         self.sub_dag = self.dagbag.dags['example_subdag_operator']
         self.runme_0 = self.dag_bash.get_task('runme_0')
+        self.example_xcom = self.dagbag.dags['example_xcom']
 
         self.dag_bash2.create_dagrun(
             run_id="test_{}".format(models.DagRun.id_for_date(datetime.now())),
@@ -1601,6 +1602,13 @@ class WebUiTests(unittest.TestCase):
             state=State.RUNNING
         )
 
+        self.example_xcom.create_dagrun(
+            run_id="test_{}".format(models.DagRun.id_for_date(datetime.now())),
+            execution_date=DEFAULT_DATE,
+            start_date=datetime.now(),
+            state=State.RUNNING
+        )
+
     def test_index(self):
         response = self.app.get('/', follow_redirects=True)
         self.assertIn("DAGs", response.data.decode('utf-8'))
@@ -1646,8 +1654,12 @@ class WebUiTests(unittest.TestCase):
         self.assertIn("example_bash_operator", response.data.decode('utf-8'))
         response = self.app.get(
             '/admin/airflow/landing_times?'
-            'days=30&dag_id=example_bash_operator')
-        self.assertIn("example_bash_operator", response.data.decode('utf-8'))
+            'days=30&dag_id=test_example_bash_operator')
+        self.assertIn("test_example_bash_operator", response.data.decode('utf-8'))
+        response = self.app.get(
+            '/admin/airflow/landing_times?'
+            'days=30&dag_id=example_xcom')
+        self.assertIn("example_xcom", response.data.decode('utf-8'))
         response = self.app.get(
             '/admin/airflow/gantt?dag_id=example_bash_operator')
         self.assertIn("example_bash_operator", response.data.decode('utf-8'))