airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-1177) variable json deserialize does not work at set defaults
Date Thu, 01 Nov 2018 20:22:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-1177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16672133#comment-16672133
] 

ASF GitHub Bot commented on AIRFLOW-1177:
-----------------------------------------

ashb closed pull request #2278: [AIRFLOW-1177] Fixed bug: default json variable cannot be
deserialized due to bad return value.
URL: https://github.com/apache/incubator-airflow/pull/2278
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/models.py b/airflow/models.py
index aab4833ae8..3fed579bad 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -3682,9 +3682,9 @@ def setdefault(cls, key, default, deserialize_json=False):
                 raise ValueError('Default Value must be set')
         else:
             if deserialize_json:
-                return json.loads(obj.val)
+                return json.loads(obj)
             else:
-                return obj.val
+                return obj
 
     @classmethod
     @provide_session


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> variable json deserialize does not work at set defaults
> -------------------------------------------------------
>
>                 Key: AIRFLOW-1177
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1177
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: models
>    Affects Versions: 1.8.0
>            Reporter: barak schoster
>            Assignee: barak schoster
>            Priority: Major
>             Fix For: 1.9.0
>
>
> at line:
> https://github.com/apache/incubator-airflow/blob/master/airflow/models.py#L3685
> obj has no attribute val, it is the val itself.
> it will throw error like:
> Variable.setdefault("some_key", deserialize_json=True,default=json.dumps(default_dag_variables))
>   File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 3586, in setdefault
>     return json.loads(obj.val)
> AttributeError: 'unicode' object has no attribute 'val'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message