Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 417E5200BB0 for ; Sun, 30 Oct 2016 23:55:22 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3FED2160AF1; Sun, 30 Oct 2016 22:55:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 84A48160ADD for ; Sun, 30 Oct 2016 23:55:21 +0100 (CET) Received: (qmail 27547 invoked by uid 500); 30 Oct 2016 22:55:20 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 27537 invoked by uid 99); 30 Oct 2016 22:55:20 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2016 22:55:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 488EFC0EFD for ; Sun, 30 Oct 2016 22:55:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 5mpia5AJb0Hy for ; Sun, 30 Oct 2016 22:55:18 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 40F245F39B for ; Sun, 30 Oct 2016 22:55:17 +0000 (UTC) Received: (qmail 27509 invoked by uid 99); 30 Oct 2016 22:55:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2016 22:55:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3A453E0BB1; Sun, 30 Oct 2016 22:55:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: xuanji@apache.org To: commits@airflow.incubator.apache.org Message-Id: <84d25bbda97b4f409823889cbfef2cc7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-airflow git commit: [AIRFLOW-604] Revert .first() to .one() Date: Sun, 30 Oct 2016 22:55:16 +0000 (UTC) archived-at: Sun, 30 Oct 2016 22:55:22 -0000 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 Authored: Sun Oct 30 18:54:59 2016 -0400 Committer: Li Xuanji 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