QChris has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/154799

Change subject: Stop extraneous report nodes for parent of recurrent reports
......................................................................

Stop extraneous report nodes for parent of recurrent reports

When creating a recurrent report, the parent node itself first
computed a report with data from today 00:00 until now. This report
got stored with the current date as filename. Afterwards the parent
node scheduled a first recurrent report run for data from
yesterday 00:00 until today 00:00. This second run also got stored
with the same current date as filename.

By both reports using the same filename, the parent node's run
immediately got overwritten by the first recurrent report run. Before
the first coalesced report generation. Hence, the parent node's run is
unnecessary, and only wastes resources.  Hence, we drop the parent
node's run, as it would also get in the way when we implement
replication lag dependent recurrent report runs in follow-up commits.

Change-Id: Ib4a000288de506a32b2cf4c16e72d7dc35af572a
---
M wikimetrics/models/report_nodes/run_report.py
1 file changed, 16 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/wikimetrics 
refs/changes/99/154799/1

diff --git a/wikimetrics/models/report_nodes/run_report.py 
b/wikimetrics/models/report_nodes/run_report.py
index bde84dc..8ec2251 100644
--- a/wikimetrics/models/report_nodes/run_report.py
+++ b/wikimetrics/models/report_nodes/run_report.py
@@ -71,13 +71,14 @@
             self.show_in_ui = False
 
         public = parameters.get('public', False)
+        recurrent = parameters.get('recurrent', False)
 
         super(RunReport, self).__init__(
             name=parameters['name'],
             user_id=user_id,
             parameters=parameters,
             public=public,
-            recurrent=parameters.get('recurrent', False),
+            recurrent=recurrent,
             recurrent_parent_id=recurrent_parent_id,
             created=created,
         )
@@ -89,9 +90,20 @@
             metric, cohort, recurrent_parent_id is None, user_id=user_id
         )
         if validate_report.valid():
-            self.children = [AggregateReport(
-                metric, cohort, metric_dict, parameters=parameters, 
user_id=user_id
-            )]
+            if recurrent and recurrent_parent_id is None:
+                # Valid parent recurrent report
+                # We do not add child nodes that compute data, as they'll get
+                # generated through the scheduler.
+                # (An initial run is kicked off in post_process through
+                # run_child_report)
+                self.children = []
+            else:
+                # Valid, but not a parent recurring report, so we add the child
+                # node that does the real computation
+                self.children = [AggregateReport(
+                    metric, cohort, metric_dict, parameters=parameters,
+                    user_id=user_id
+                )]
         else:
             self.children = [validate_report]
 

-- 
To view, visit https://gerrit.wikimedia.org/r/154799
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4a000288de506a32b2cf4c16e72d7dc35af572a
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikimetrics
Gerrit-Branch: master
Gerrit-Owner: QChris <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to