From f55075fab8f12d94c0e819ac46beae443f1b42b7 Mon Sep 17 00:00:00 2001 From: Krishna Puttaswamy Date: Tue, 18 Nov 2014 13:16:44 -0800 Subject: [PATCH] health check + reload dags --- airflow/www/app.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/airflow/www/app.py b/airflow/www/app.py index 2c20bba42e..49e599bd75 100644 --- a/airflow/www/app.py +++ b/airflow/www/app.py @@ -57,6 +57,11 @@ class GraphForm(Form): def index(): return redirect(url_for('admin.index')) +@app.route('/health') +def health(): + """ We can add an array of tests here to check the server's health """ + content = Markup(markdown.markdown("The server is healthy!")) + return content; class HomeView(AdminIndexView): """ @@ -504,7 +509,7 @@ class DagModelView(ModelViewOnly): 'filepath': filepath_formatter, } column_list = ('dag_id', 'task_count', 'filepath') -mv = DagModelView(models.DAG, session, name="DAGs") +mv = DagModelView(models.DAG, session, name="DAGs", endpoint="dags") admin.add_view(mv) @@ -571,6 +576,14 @@ class LogModelView(ModelViewOnly): mv = LogModelView(models.Log, session, name="Logs", category="Admin") admin.add_view(mv) +class ReloadTaskView(BaseView): + @expose('/') + def index(self): + logging.info("Reloading the dags") + bag = models.DagBag(); + return redirect(url_for('dags.index_view')) +admin.add_view(ReloadTaskView(name='Reload DAGs', category="Admin")) + if __name__ == "__main__": logging.info("Starting the web server.") app.run(debug=True)