You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Kaxil Naik (JIRA)" <ji...@apache.org> on 2019/01/12 13:31:00 UTC

[jira] [Updated] (AIRFLOW-1088) DagBag's import_errors() contain quoted string messages

     [ https://issues.apache.org/jira/browse/AIRFLOW-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kaxil Naik updated AIRFLOW-1088:
--------------------------------
    Fix Version/s:     (was: 1.7.1.3)

> DagBag's import_errors() contain quoted string messages
> -------------------------------------------------------
>
>                 Key: AIRFLOW-1088
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1088
>             Project: Apache Airflow
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>         Environment: Python 2.7, 3.5, 3.6
>            Reporter: Vitor Baptista
>            Priority: Major
>
> For example, consider that we're loading a DAG folder that has a DAG requiring Variable {{FOO}} that doesn't exist, as follows:
> {code}
> dagbag = airflow.models.DagBag(dag_folder=dag_folder, include_examples=False)
> dagbag.import_errors.values()
> # ["u'Variable FOO does not exist"]
> {code}
> Notice that the error message from {{dagbag.import_errors.values()}} contain is inside {{u'...'}}. The problem appears to be that we're converting the {{KeyError}} messages using {{str(exception)}} (see lines 272 and 305 on https://github.com/apache/incubator-airflow/blob/53ca5084561fd5c13996609f2eda6baf717249b5/airflow/models.py).
> We can reproduce a similar error using:
> {code}
> message = 'error message'
> error = KeyError(message)
> assert message == str(error), '"{}" != "{}"'.format(message, str(error))
> # Traceback (most recent call last):
> #   File "<stdin>", line 1, in <module>
> # AssertionError: "error message" != "'error message'"
> {code}
> I tested it on Python 2.7, 3.5 and 3.6 and got the same error, so my guess is that it affects Python 2.7+.
> This problem doesn't occur with Airflow 1.7.1.3, although we use the same {{str(exception)}}, so my guess is that there's something different in how we throw the exception.



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