| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 | 6 |
| 7 from model.base_try_job_data import BaseTryJobData | 7 from model.base_try_job_data import BaseTryJobData |
| 8 from model.wf_try_job import WfTryJob | 8 from model.wf_try_job import WfTryJob |
| 9 | 9 |
| 10 | 10 |
| 11 class WfTryJobData(BaseTryJobData): | 11 class WfTryJobData(BaseTryJobData): |
| 12 """Represents a tryjob's data for a completed compile or test try job.""" | 12 """Represents a tryjob's data for a completed compile or test try job.""" |
| 13 # Number of commits in the revision range. | 13 # Number of commits in the revision range. |
| 14 regression_range_size = ndb.IntegerProperty(indexed=False) | 14 regression_range_size = ndb.IntegerProperty(indexed=False) |
| 15 | 15 |
| 16 # Number of commits analyzed to determine a culprit if any. | 16 # Number of commits analyzed to determine a culprit, if any. |
| 17 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) | 17 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) |
| 18 | 18 |
| 19 # Culprit(s) determined to have caused the failure, if any. | 19 # Culprit(s) determined to have caused the failure, if any. |
| 20 culprits = ndb.JsonProperty(indexed=False) | 20 culprits = ndb.JsonProperty(indexed=False) |
| 21 | 21 |
| 22 # Whether or not the try job had compile targets passed (compile only). | 22 # Whether or not the try job had compile targets passed (compile only). |
| 23 has_compile_targets = ndb.BooleanProperty(indexed=True) | 23 has_compile_targets = ndb.BooleanProperty(indexed=True) |
| 24 | 24 |
| 25 # Whether or not the try job had heuristic results to guide it. | 25 # Whether or not the try job had heuristic results to guide it. |
| 26 has_heuristic_results = ndb.BooleanProperty(indexed=True) | 26 has_heuristic_results = ndb.BooleanProperty(indexed=True) |
| 27 | 27 |
| 28 # The type of try job, such as 'compile' or 'test'. | 28 # The type of try job, such as 'compile' or 'test'. |
| 29 try_job_type = ndb.StringProperty(indexed=True) | 29 try_job_type = ndb.StringProperty(indexed=True) |
| 30 | 30 |
| 31 @ndb.ComputedProperty | 31 @ndb.ComputedProperty |
| 32 def build_number(self): | 32 def build_number(self): |
| 33 return WfTryJob.GetBuildNumber(self.try_job_key) | 33 return WfTryJob.GetBuildNumber(self.try_job_key) |
| 34 | 34 |
| 35 @staticmethod | 35 @staticmethod |
| 36 def _CreateKey(build_id): # pragma: no cover | 36 def _CreateKey(build_id): # pragma: no cover |
| 37 return ndb.Key('WfTryJobData', build_id) | 37 return ndb.Key('WfTryJobData', build_id) |
| 38 | 38 |
| 39 @staticmethod | 39 @staticmethod |
| 40 def Create(build_id): # pragma: no cover | 40 def Create(build_id): # pragma: no cover |
| 41 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) | 41 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) |
| 42 | 42 |
| 43 @staticmethod | 43 @staticmethod |
| 44 def Get(build_id): # pragma: no cover | 44 def Get(build_id): # pragma: no cover |
| 45 return WfTryJobData._CreateKey(build_id).get() | 45 return WfTryJobData._CreateKey(build_id).get() |
| OLD | NEW |