Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: appengine/monorail/features/filterrules.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/monorail/features/cues.py ('k') | appengine/monorail/features/filterrules_helpers.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/monorail/features/filterrules.py
diff --git a/appengine/monorail/features/filterrules.py b/appengine/monorail/features/filterrules.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb5f84a5fb81ddecd7dfa82f3429d31575eb300a
--- /dev/null
+++ b/appengine/monorail/features/filterrules.py
@@ -0,0 +1,47 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Implementation of the filter rules feature."""
+
+import logging
+
+from features import filterrules_helpers
+from framework import jsonfeed
+from tracker import tracker_constants
+
+
+class RecomputeDerivedFieldsTask(jsonfeed.InternalTask):
+ """JSON servlet that recomputes derived fields on a batch of issues."""
+
+ def HandleRequest(self, mr):
+ """Recompute derived field values on one range of issues in a shard."""
+ logging.info(
+ 'params are %r %r %r %r', mr.specified_project_id, mr.lower_bound,
+ mr.upper_bound, mr.shard_id)
+ project = self.services.project.GetProject(
+ mr.cnxn, mr.specified_project_id)
+ config = self.services.config.GetProjectConfig(
+ mr.cnxn, mr.specified_project_id)
+ filterrules_helpers.RecomputeAllDerivedFieldsNow(
+ mr.cnxn, self.services, project, config, lower_bound=mr.lower_bound,
+ upper_bound=mr.upper_bound, shard_id=mr.shard_id)
+
+ return {
+ 'success': True,
+ }
+
+
+class ReindexQueueCron(jsonfeed.InternalTask):
+ """JSON servlet that reindexes some issues each minute, as needed."""
+
+ def HandleRequest(self, mr):
+ """Reindex issues that are listed in the the reindex table."""
+ num_reindexed = self.services.issue.ReindexIssues(
+ mr.cnxn, tracker_constants.MAX_ISSUES_TO_REINDEX_PER_MINUTE,
+ self.services.user)
+
+ return {
+ 'num_reindexed': num_reindexed,
+ }
« no previous file with comments | « appengine/monorail/features/cues.py ('k') | appengine/monorail/features/filterrules_helpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698