[jira] [Commented] (AIRFLOW-659) Automatic Refresh on DAG Graph View

2018-12-17 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16723653#comment-16723653
 ] 

ASF GitHub Bot commented on AIRFLOW-659:


stale[bot] closed pull request #1910: [AIRFLOW-659] Automatic Refresh on DAG 
Graph View
URL: https://github.com/apache/incubator-airflow/pull/1910
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/configuration.py b/airflow/configuration.py
index 265f7289ea..7d17451100 100644
--- a/airflow/configuration.py
+++ b/airflow/configuration.py
@@ -261,6 +261,11 @@ def run_command(command):
 # privacy.
 demo_mode = False
 
+# Rate at which to automatically refresh the task states in the graph view in
+# milliseconds. If not set or set to 0, the graph will require refreshing
+# manually. Otherwise the manual refresh button will not be displayed.
+graph_refresh_rate = 0
+
 # The amount of time (in secs) webserver will wait for initial handshake
 # while fetching logs from other worker machine
 log_fetch_timeout_sec = 5
diff --git a/airflow/www/templates/airflow/graph.html 
b/airflow/www/templates/airflow/graph.html
index 24fc508027..72efaa6747 100644
--- a/airflow/www/templates/airflow/graph.html
+++ b/airflow/www/templates/airflow/graph.html
@@ -1,13 +1,13 @@
-{# 
+{#
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
-  
+
 http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,9 +76,11 @@
 Oops.
 
 
+{% if refresh_rate|int == 0 %}
 
 
 
+{% endif %}
 
 
 
@@ -345,25 +347,29 @@
   $('#datatable_section').hide(1000);
 }
 
-d3.select("#refresh_button").on("click",
-function() {
-$("#loading").css("display", "block");
-$("div#svg_container").css("opacity", "0.2");
-$.get(
-"/admin/airflow/object/task_instances",
-{dag_id : "{{ dag.dag_id }}", execution_date : "{{ 
execution_date }}"})
-.done(
-function(task_instances) {
-update_nodes_states(JSON.parse(task_instances));
-$("#loading").hide();
-$("div#svg_container").css("opacity", "1");
-$('#error').hide();
-}
-).fail(function(jqxhr, textStatus, err) {
-error(textStatus + ': ' + err);
-});
-}
-);
+function refreshGraph() {
+$("#loading").css("display", "block");
+$("div#svg_container").css("opacity", "0.2");
+$.get(
+"/admin/airflow/object/task_instances",
+{dag_id : "{{ dag.dag_id }}", execution_date : "{{ execution_date 
}}"})
+.done(
+function(task_instances) {
+update_nodes_states(JSON.parse(task_instances));
+$("#loading").hide();
+$("div#svg_container").css("opacity", "1");
+$('#error').hide();
+}
+).fail(function(jqxhr, textStatus, err) {
+error(textStatus + ': ' + err);
+});
+}
+
+{% if refresh_rate|int > 0 %}
+window.setInterval(refreshGraph, {{ refresh_rate }})
+{% else %}
+d3.select("#refresh_button").on("click", refreshGraph);
+{% endif %}
 
 
 
diff --git a/airflow/www/views.py b/airflow/www/views.py
index d22e8e4b3f..cd4dd88403 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1416,6 +1416,10 @@ class GraphForm(Form):
 session.close()
 doc_md = markdown.markdown(dag.doc_md) if hasattr(dag, 'doc_md') else 
''
 
+refresh_rate = int(conf.get('webserver', 'graph_refresh_rate'))
+if not refresh_rate:
+refresh_rate = 0
+
 return self.render(
 'airflow/graph.html',
 dag=dag,
@@ -1435,7 +1439,8 @@ class GraphForm(Form):
 task_instances=json.dumps(task_instances, indent=2),
 tasks=json.dumps(tasks, indent=2),
 nodes=json.dumps(nodes, indent=2),
-edges=json.dumps(edges, indent=2),)
+edges=json.dumps(edges, indent=2),
+refresh_rate=refresh_rate)
 
 

[jira] [Commented] (AIRFLOW-659) Automatic Refresh on DAG Graph View

2018-09-02 Thread Apache Spark (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16601567#comment-16601567
 ] 

Apache Spark commented on AIRFLOW-659:
--

User 'robin-miller-ow' has created a pull request for this issue:
https://github.com/apache/incubator-airflow/pull/1910

> Automatic Refresh on DAG Graph View
> ---
>
> Key: AIRFLOW-659
> URL: https://issues.apache.org/jira/browse/AIRFLOW-659
> Project: Apache Airflow
>  Issue Type: Improvement
>  Components: ui, webserver
>Reporter: Robin Miller
>Assignee: Robin Miller
>Priority: Minor
>
> It would be nice not to have to press a button to refresh the graph view all 
> the time. There's no reason not to have the option to have this refresh 
> itself regularly so you can have it on a screen in the background and know 
> that it's reasonably up to date when you glance across at it.



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


[jira] [Commented] (AIRFLOW-659) Automatic Refresh on DAG Graph View

2018-02-22 Thread Luke Bodeen (JIRA)

[ 
https://issues.apache.org/jira/browse/AIRFLOW-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16373460#comment-16373460
 ] 

Luke Bodeen commented on AIRFLOW-659:
-

agree on this, +1

> Automatic Refresh on DAG Graph View
> ---
>
> Key: AIRFLOW-659
> URL: https://issues.apache.org/jira/browse/AIRFLOW-659
> Project: Apache Airflow
>  Issue Type: Improvement
>  Components: ui, webserver
>Reporter: Robin Miller
>Assignee: Robin Miller
>Priority: Minor
>
> It would be nice not to have to press a button to refresh the graph view all 
> the time. There's no reason not to have the option to have this refresh 
> itself regularly so you can have it on a screen in the background and know 
> that it's reasonably up to date when you glance across at it.



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