airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From criccom...@apache.org
Subject [1/2] incubator-airflow git commit: [AIRFLOW-252] Raise Sqlite exceptions when deleting tasks instance in WebUI
Date Tue, 21 Jun 2016 15:23:54 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master 3ffa656d9 -> 072fa8ee5


[AIRFLOW-252] Raise Sqlite exceptions when deleting tasks instance in WebUI

If users who use SQLite as backend try to delete a task via browser, it fails with an exception.
Though this is a bug on Flask-Admin's side basically, this patch provides a workaround for
it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/79d3be5b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/79d3be5b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/79d3be5b

Branch: refs/heads/master
Commit: 79d3be5b10d72538a605c7e24da31ccdd711013c
Parents: 45b735b
Author: Kengo Seki <sekikn@apache.org>
Authored: Mon Jun 20 23:03:22 2016 +0000
Committer: Kengo Seki <sekikn@apache.org>
Committed: Mon Jun 20 23:03:22 2016 +0000

----------------------------------------------------------------------
 airflow/www/views.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/79d3be5b/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index f26ca7b..1fb3f91 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -38,6 +38,7 @@ from flask import (
 from flask_admin import BaseView, expose, AdminIndexView
 from flask_admin.contrib.sqla import ModelView
 from flask_admin.actions import action
+from flask_admin.tools import iterdecode
 from flask_login import flash
 from flask._compat import PY2
 
@@ -2097,6 +2098,17 @@ class TaskInstanceModelView(ModelViewOnly):
                 raise Exception("Ooops")
             flash('Failed to set state', 'error')
 
+    def get_one(self, id):
+        """
+        As a workaround for AIRFLOW-252, this method overrides Flask-Admin's ModelView.get_one().
+
+        TODO: this method should be removed once the below bug is fixed on Flask-Admin side.
+        https://github.com/flask-admin/flask-admin/issues/1226
+        """
+        task_id, dag_id, execution_date = iterdecode(id)
+        execution_date = dateutil.parser.parse(execution_date)
+        return self.session.query(self.model).get((task_id, dag_id, execution_date))
+
 
 class ConnectionModelView(wwwutils.SuperUserMixin, AirflowModelView):
     create_template = 'airflow/conn_create.html'


Mime
View raw message