airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xua...@apache.org
Subject incubator-airflow git commit: [AIRFLOW-604] Revert .first() to .one()
Date Sun, 30 Oct 2016 22:55:16 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master 5616c029d -> 527e3ecdb


[AIRFLOW-604] Revert .first() to .one()

.one() enforces the integrity of airflow as we
expect
a tuple to be returned here. If not the database
is
inconsistent and airflow should error out.

Dear Airflow Maintainers,

.one() enforces the integrity of airflow as we
expect
a tuple to be returned here. If not the database
is
inconsistent and airflow should error out.

partially reverts: https://github.com/apache
/incubator-airflow/pull/1730

Closes #1858 from bolkedebruin/AIRFLOW-604


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

Branch: refs/heads/master
Commit: 527e3ecdb8adf9d7a2f40c3ce2c30f2ccaf1924a
Parents: 5616c02
Author: Bolke de Bruin <bolke@xs4all.nl>
Authored: Sun Oct 30 18:54:59 2016 -0400
Committer: Li Xuanji <xuanji@gmail.com>
Committed: Sun Oct 30 18:54:59 2016 -0400

----------------------------------------------------------------------
 airflow/models.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/527e3ecd/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 91662de..1207f14 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -3654,10 +3654,10 @@ class DagRun(Base):
             DR.dag_id == self.dag_id,
             DR.execution_date == self.execution_date,
             DR.run_id == self.run_id
-        ).first()
-        if dr:
-            self.id = dr.id
-            self.state = dr.state
+        ).one()
+
+        self.id = dr.id
+        self.state = dr.state
 
     @staticmethod
     @provide_session


Mime
View raw message