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

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

Issue 2124973003: These are the database objects used while finding the regression range. 1/3 (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Database objects post offline discussion Created 4 years, 5 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
Index: appengine/findit/model/base_analysis.py
diff --git a/appengine/findit/model/base_analysis.py b/appengine/findit/model/base_analysis.py
new file mode 100644
index 0000000000000000000000000000000000000000..9410a1538023b1aa9ad10a6106a3e3252ea7bdbf
--- /dev/null
+++ b/appengine/findit/model/base_analysis.py
@@ -0,0 +1,84 @@
+# 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 common import constants
+from common.waterfall import failure_type
+from model.base_build_model import BaseBuildModel
+from model import analysis_status
+from model import result_status
+
+
+class BaseAnalysis(ndb.Model):
+ """Represents an analysis of a build of a builder in a Chromium waterfall.
+ """
+
+ @property
+ def completed(self):
stgao 2016/07/14 18:01:32 Should this and some other properties below belong
caiw 2016/07/15 00:57:59 Per offline discussion, I think we are keeping the
+ return self.status in (
+ analysis_status.COMPLETED, analysis_status.ERROR)
+
+ @property
+ def duration(self):
+ if not self.completed or not self.end_time or not self.start_time:
+ return None
+
+ return int((self.end_time - self.start_time).total_seconds())
+
+ @property
+ def failed(self):
+ return self.status == analysis_status.ERROR
+
+ @property
+ def status_description(self):
+ return analysis_status.STATUS_TO_DESCRIPTION.get(self.status, 'Unknown')
+
+ @property
+ def result_status_description(self):
+ return result_status.RESULT_STATUS_TO_DESCRIPTION.get(
+ self.result_status, '')
+
+ @property
+ def correct(self):
+ """Returns whether the analysis result is correct or not.
+
+ Returns:
+ True: correct
+ False: incorrect
+ None: don't know yet.
+ """
+ if not self.completed or self.failed:
+ return None
+
+ if self.result_status in (
stgao 2016/07/14 18:01:33 ``result_status`` is not defined in this model.
caiw 2016/07/15 00:57:59 Ok it seems like result_status is more of a wf thi
+ result_status.FOUND_CORRECT,
+ result_status.NOT_FOUND_CORRECT,
+ result_status.FOUND_CORRECT_DUPLICATE):
+ return True
+
+ if self.result_status in (
+ result_status.FOUND_INCORRECT,
+ result_status.NOT_FOUND_INCORRECT,
+ result_status.FOUND_INCORRECT_DUPLICATE):
+ return False
+
+ return None
+
+ # The url path to the pipeline status page.
+ pipeline_status_path = ndb.StringProperty(indexed=False)
+
+ # The status of the analysis.
+ status = ndb.IntegerProperty(
+ default=analysis_status.PENDING, indexed=False)
+ # When the analysis was requested.
+ request_time = ndb.DateTimeProperty(indexed=False)
+ # When the analysis actually started.
+ start_time = ndb.DateTimeProperty(indexed=False)
stgao 2016/07/14 18:01:32 These seems almost the same as those in progress.p
caiw 2016/07/15 00:57:59 Per offline discussion, we will leave this until l
+ # When the analysis actually ended.
+ end_time = ndb.DateTimeProperty(indexed=False)
+ # When the analysis was updated.
+ updated_time = ndb.DateTimeProperty(indexed=False, auto_now=True)
+ # Record which version of analysis.
+ version = ndb.StringProperty(indexed=False)
« no previous file with comments | « no previous file | appengine/findit/model/base_flake_model.py » ('j') | appengine/findit/model/base_flake_model.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698