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

ASF GitHub Bot commented on AIRFLOW-3348:
-----------------------------------------

feng-tao closed pull request #4197:  [AIRFLOW-3348] update run statistics on 
dag refresh
URL: https://github.com/apache/incubator-airflow/pull/4197
 
 
   

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/www/views.py b/airflow/www/views.py
index 67c31bb9b1..8792191e21 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1877,6 +1877,8 @@ def refresh(self, session=None):
             session.merge(orm_dag)
         session.commit()
 
+        models.DagStat.update([dag_id], session=session, dirty_only=False)
+
         dagbag.get_dag(dag_id)
         flash("DAG [{}] is now fresh as a daisy".format(dag_id))
         return redirect(request.referrer)
diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py
index 29e8da1b9c..1825e15000 100644
--- a/airflow/www_rbac/views.py
+++ b/airflow/www_rbac/views.py
@@ -1627,6 +1627,8 @@ def refresh(self, session=None):
         # sync dag permission
         appbuilder.sm.sync_perm_for_dag(dag_id)
 
+        models.DagStat.update([dag_id], session=session, dirty_only=False)
+
         dagbag.get_dag(dag_id)
         flash("DAG [{}] is now fresh as a daisy".format(dag_id))
         return redirect(request.referrer)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Refresh run stats on dag refresh
> --------------------------------
>
>                 Key: AIRFLOW-3348
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3348
>             Project: Apache Airflow
>          Issue Type: Improvement
>            Reporter: Marcin Szymanski
>            Assignee: Marcin Szymanski
>            Priority: Minor
>
> In some cases dag run statistics may become outdated, for example, when dag 
> run is deleted.
> As the view from which dag runs are deleted permits to delete runs fromĀ 
> multiple dags in a single transaction, this seems to be the most reasonable 
> place to update run statistics



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

Reply via email to