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

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

Issue 820113002: [Findit] Add a sub-pipeline to detect first-known failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Test will come in next patchset. Created 6 years 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
Index: appengine/findit/model/build_analysis.py
diff --git a/appengine/findit/model/build_analysis.py b/appengine/findit/model/build_analysis.py
new file mode 100644
index 0000000000000000000000000000000000000000..aaba744bda12b2f1e88485921c1006d161d3a69e
--- /dev/null
+++ b/appengine/findit/model/build_analysis.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2014 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.build_analysis_status import BuildAnalysisStatus
+
+
+class BuildAnalysis(ndb.Model):
+ """Represent an analysis of a build cycle of a builder in a waterfall."""
qyearsley 2014/12/29 19:44:53 As for functions, I think that verbs in docstrings
stgao 2015/01/03 01:31:47 Done.
+
+ @staticmethod
+ def CreateKey(master_name, builder_name, build_number): # pragma: no cover
+ return ndb.Key('Master', master_name, 'Builder', builder_name,
+ 'BuildAnalysis', build_number)
+
+ @staticmethod
+ def CreateBuildAnalysis(
+ master_name, builder_name, build_number): # pragma: no cover
+ """Create a BuildAnalysis instance, but not save it to datastore."""
qyearsley 2014/12/29 19:44:53 You can change this to: """Creates a BuildAnalysis
stgao 2015/01/03 01:31:47 Done.
+ return BuildAnalysis(
+ key=BuildAnalysis.CreateKey(master_name, builder_name, build_number),
+ master_name=master_name,
+ builder_name=builder_name,
+ build_number=build_number)
+
+ @staticmethod
+ def GetBuildAnalysis(
+ master_name, builder_name, build_number): # pragma: no cover
+ return BuildAnalysis.CreateKey(
+ master_name, builder_name, build_number).get()
+
+ def Reset(self):
+ """Reset to the state as if no analysis is run."""
+ self.status = BuildAnalysisStatus.PENDING
+ self.start_time = None
+ self.updated_time = None
+
+ # Information of the analyzed build.
+ master_name = ndb.StringProperty(indexed=False)
+ builder_name = ndb.StringProperty(indexed=False)
+ build_number = ndb.IntegerProperty(indexed=False)
qyearsley 2014/12/29 19:44:53 Since master_name, builder_name and build_number a
stgao 2015/01/03 01:31:47 Good idea! I created a base class for this, becaus
+ build_start_time = ndb.DateTimeProperty(indexed=True)
+
+ # Information of analysis processing.
+ status = ndb.IntegerProperty(
+ default=BuildAnalysisStatus.PENDING, indexed=False)
+ start_time = ndb.DateTimeProperty(indexed=False)
+ updated_time = ndb.DateTimeProperty(indexed=False)

Powered by Google App Engine
This is Rietveld 408576698