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

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

Issue 2605803002: [Findit] Refactoring WfTryJobData into BaseTryJobData, WfTryJobData, and FlakeTryJobData (Closed)
Patch Set: Fixing nits Created 3 years, 11 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/wf_try_job_data.py
diff --git a/appengine/findit/model/wf_try_job_data.py b/appengine/findit/model/wf_try_job_data.py
index d3ba5100afcd3a954083de4e63f29a01c323ccec..1787eae7db31a2eab618dd920bb1b90d7719db27 100644
--- a/appengine/findit/model/wf_try_job_data.py
+++ b/appengine/findit/model/wf_try_job_data.py
@@ -4,42 +4,41 @@
from google.appengine.ext import ndb
+from model.base_try_job_data import BaseTryJobData
-class WfTryJobData(ndb.Model):
- """Represents a tryjob's data for a completed try job."""
- # The original master on which the build was detected to have failed.
- master_name = ndb.StringProperty(indexed=True)
- # The original buildername on which the build was detected to have failed.
- builder_name = ndb.StringProperty(indexed=True)
- # The original build number.
- build_number = ndb.IntegerProperty(indexed=True)
- # The type of try job, such as 'compile' or 'test'.
- try_job_type = ndb.StringProperty(indexed=True)
- # When the try job was created.
- request_time = ndb.DateTimeProperty(indexed=True)
- # When the try job began executing.
- start_time = ndb.DateTimeProperty(indexed=True)
- # When the try job completed.
- end_time = ndb.DateTimeProperty(indexed=True)
+
+class WfTryJobData(BaseTryJobData):
+ """Represents a tryjob's data for a completed compile or test try job."""
# Number of commits in the revision range.
regression_range_size = ndb.IntegerProperty(indexed=False)
+
# Number of commits analyzed to determine a culprit if any.
number_of_commits_analyzed = ndb.IntegerProperty(indexed=False)
+
# Culprit(s) determined to have caused the failure, if any.
culprits = ndb.JsonProperty(indexed=False)
- # The url to the try job build page.
- try_job_url = ndb.StringProperty(indexed=False)
- # Error message and reason, if any.
- error = ndb.JsonProperty(indexed=False)
- # Error code if anything went wrong with the try job.
- error_code = ndb.IntegerProperty(indexed=True)
- # The last buildbucket build response received.
- last_buildbucket_response = ndb.JsonProperty(indexed=False, compressed=True)
+
# Whether or not the try job had compile targets passed (compile only).
has_compile_targets = ndb.BooleanProperty(indexed=True)
+
# Whether or not the try job had heuristic results to guide it.
has_heuristic_results = ndb.BooleanProperty(indexed=True)
+ # The type of try job, such as 'compile' or 'test'.
+ try_job_type = ndb.StringProperty(indexed=True)
+
+ @ndb.ComputedProperty
+ def master_name(self):
chanli 2017/01/07 02:39:39 Not sure if we should have similar implementation
chanli 2017/01/07 02:39:39 Since both wf_try_job and flake_try_job have maste
lijeffrey 2017/01/09 19:04:01 Done.
lijeffrey 2017/01/09 19:04:01 master_name and builder_name moved to base class.
+ return self.try_job_key.pairs()[0][1].split('/')[0]
+
+ @ndb.ComputedProperty
+ def builder_name(self):
+ return self.try_job_key.pairs()[0][1].split('/')[1]
+
+ @ndb.ComputedProperty
+ def build_number(self):
+ return int(self.try_job_key.pairs()[0][1].split('/')[2])
+
@staticmethod
def _CreateKey(build_id): # pragma: no cover
return ndb.Key('WfTryJobData', build_id)

Powered by Google App Engine
This is Rietveld 408576698