From 804d1848089ac25aa8f34ca0b2d4d67b0d588be5 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 7 Nov 2014 17:52:45 +0000 Subject: [PATCH] Minor UI fix/tweak --- airflow/www/app.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/airflow/www/app.py b/airflow/www/app.py index 3d2f5714d0..2d6d69ebad 100644 --- a/airflow/www/app.py +++ b/airflow/www/app.py @@ -160,11 +160,15 @@ class Airflow(BaseView): if hasattr(task, attr_name): source = getattr(task, attr_name) if source.endswith('.sql') or source.endswith('.hql'): - f = open(dag.folder + '/' + source, 'r') - source = f.read() - f.close() + try: + f = open(dag.folder + '/' + source, 'r') + source = f.read() + f.close() + except Exception as e: + logging.error(e) + source = getattr(task, attr_name) special_attrs[attr_name] = highlight( - getattr(task, attr_name), + source, SqlLexer(), HtmlFormatter(noclasses=True) )