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 4F538200B50 for ; Thu, 14 Jul 2016 20:08:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4E3A4160A63; Thu, 14 Jul 2016 18:08:45 +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 9E51F160A60 for ; Thu, 14 Jul 2016 20:08:44 +0200 (CEST) Received: (qmail 17693 invoked by uid 500); 14 Jul 2016 18:08:40 -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 17616 invoked by uid 99); 14 Jul 2016 18:08:40 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 18:08:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 02C1A1A01CD for ; Thu, 14 Jul 2016 18:08:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 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=-1.426] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id QPGUiDJb_Arb for ; Thu, 14 Jul 2016 18:08:38 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 9D2A85FBB9 for ; Thu, 14 Jul 2016 18:08:37 +0000 (UTC) Received: (qmail 15744 invoked by uid 99); 14 Jul 2016 18:08:36 -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; Thu, 14 Jul 2016 18:08:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C17DEE383A; Thu, 14 Jul 2016 18:08:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bolke@apache.org To: commits@airflow.incubator.apache.org Date: Thu, 14 Jul 2016 18:08:36 -0000 Message-Id: <08806b2183ff4586bf274e08e353114e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-airflow git commit: [AIRFLOW-337] Add __repr__ to VariableAccessor and VariableJsonAccessor archived-at: Thu, 14 Jul 2016 18:08:45 -0000 Repository: incubator-airflow Updated Branches: refs/heads/master c32452aba -> aea1fa2d6 [AIRFLOW-337] Add __repr__ to VariableAccessor and VariableJsonAccessor The VariableJsonAccessor and VariableAccessor were missing the __repr__ function that leads to a VariableError when printing out the context being passed to for example a PythonOperator. Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/3079da06 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/3079da06 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/3079da06 Branch: refs/heads/master Commit: 3079da06249d7ff87dfc4ed58c999f7b81f3159a Parents: 3c91bbb Author: Bolke de Bruin Authored: Thu Jul 14 19:30:46 2016 +0200 Committer: Bolke de Bruin Committed: Thu Jul 14 19:30:46 2016 +0200 ---------------------------------------------------------------------- airflow/models.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3079da06/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 60de65f..2736076 100644 --- a/airflow/models.py +++ b/airflow/models.py @@ -1466,17 +1466,25 @@ class TaskInstance(Base): {var.variable_name}. """ def __init__(self): - pass + self.var = None def __getattr__(self, item): - return Variable.get(item) + self.var = Variable.get(item) + return self.var + + def __repr__(self): + return str(self.var) class VariableJsonAccessor: def __init__(self): - pass + self.var = None def __getattr__(self, item): - return Variable.get(item, deserialize_json=True) + self.var = Variable.get(item, deserialize_json=True) + return self.var + + def __repr__(self): + return str(self.var) return { 'dag': task.dag,