Vitor Baptista created AIRFLOW-1088: ---------------------------------------
Summary: 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 Fix For: Airflow 1.7.1.3 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 (v6.3.15#6346)