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

Unified Diff: appengine/findit/model/wf_culprit.py

Issue 2075423002: [Findit] Group failures by culprit and send notification to codereview. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address Jeff's comments. Tests will be added in next patch. Created 4 years, 6 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 | « no previous file | appengine/findit/waterfall/identify_try_job_culprit_pipeline.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/model/wf_culprit.py
diff --git a/appengine/findit/model/wf_culprit.py b/appengine/findit/model/wf_culprit.py
new file mode 100644
index 0000000000000000000000000000000000000000..37099a25609b62532e1014cbefe67586bd722925
--- /dev/null
+++ b/appengine/findit/model/wf_culprit.py
@@ -0,0 +1,53 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from google.appengine.ext import ndb
+
+from model import analysis_status as status
+
+
+class WfCulprit(ndb.Model):
+ """Represents a culprit that causes a group of failures on Chromium waterfall.
+
+ 'Wf' is short for waterfall.
+ """
+
+ # Repo or project name of the culprit, eg: chromium, etc.
+ repo_name = ndb.StringProperty()
+
+ # The Git hash revision of the culprit.
+ revision = ndb.StringProperty(indexed=False)
+
+ # When the code-review of this culprit was notified.
+ cr_notification_time = ndb.DateTimeProperty()
lijeffrey 2016/06/21 17:59:54 do we still want to do ndb.DateTimeProperty(indexe
stgao 2016/06/24 16:10:28 By default, it is indexed. But I made it explicit.
+
+ # The status of code-review notification.
+ cr_notification_status = ndb.IntegerProperty()
+
+ # The list of builds in which the culprit caused some breakage.
+ builds = ndb.JsonProperty(indexed=False, default=[])
+
+ @property
+ def project_name(self): # pragma: no cover
+ return self.repo_name
+
+ @property
+ def cr_notification_processed(self):
+ return self.cr_notification_status in (status.COMPLETED, status.RUNNING)
+
+ @property
+ def cr_notified(self):
+ return self.cr_notification_status == status.COMPLETED
+
+ @classmethod
+ def _CreateKey(cls, repo_name, revision): # pragma: no cover
+ return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
+
+ @classmethod
+ def Create(cls, repo_name, revision): # pragma: no cover
+ return cls(key=cls._CreateKey(repo_name, revision))
+
+ @classmethod
+ def Get(cls, repo_name, revision): # pragma: no cover
+ return cls._CreateKey(repo_name, revision).get()
« no previous file with comments | « no previous file | appengine/findit/waterfall/identify_try_job_culprit_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698