| 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 | 7 |
| 8 class WfTryJobData(ndb.Model): | 8 class WfTryJobData(ndb.Model): |
| 9 """Represents a tryjob's data for a completed try job.""" | 9 """Represents a tryjob's data for a completed try job.""" |
| 10 # The original master on which the build was detected to have failed. | 10 # The original master on which the build was detected to have failed. |
| 11 master_name = ndb.StringProperty(indexed=True) | 11 master_name = ndb.StringProperty(indexed=True) |
| 12 # The original buildername on which the build was detected to have failed. | 12 # The original buildername on which the build was detected to have failed. |
| 13 builder_name = ndb.StringProperty(indexed=True) | 13 builder_name = ndb.StringProperty(indexed=True) |
| 14 # The original build number. |
| 15 build_number = ndb.IntegerProperty(indexed=True) |
| 14 # The type of try job, such as 'compile' or 'test'. | 16 # The type of try job, such as 'compile' or 'test'. |
| 15 try_job_type = ndb.StringProperty(indexed=True) | 17 try_job_type = ndb.StringProperty(indexed=True) |
| 16 # When the try job was created. | 18 # When the try job was created. |
| 17 request_time = ndb.DateTimeProperty(indexed=True) | 19 request_time = ndb.DateTimeProperty(indexed=True) |
| 18 # When the try job began executing. | 20 # When the try job began executing. |
| 19 start_time = ndb.DateTimeProperty(indexed=True) | 21 start_time = ndb.DateTimeProperty(indexed=True) |
| 20 # When the try job completed. | 22 # When the try job completed. |
| 21 end_time = ndb.DateTimeProperty(indexed=True) | 23 end_time = ndb.DateTimeProperty(indexed=True) |
| 22 # Number of commits in the revision range. | 24 # Number of commits in the revision range. |
| 23 regression_range_size = ndb.IntegerProperty(indexed=False) | 25 regression_range_size = ndb.IntegerProperty(indexed=False) |
| 24 # Number of commits analyzed to determine a culprit if any. | 26 # Number of commits analyzed to determine a culprit if any. |
| 25 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) | 27 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) |
| 26 # Culprit(s) determined to have caused the failure, if any. | 28 # Culprit(s) determined to have caused the failure, if any. |
| 27 culprits = ndb.JsonProperty(indexed=False) | 29 culprits = ndb.JsonProperty(indexed=False) |
| 28 # The url to the try job build page. | 30 # The url to the try job build page. |
| 29 try_job_url = ndb.StringProperty(indexed=False) | 31 try_job_url = ndb.StringProperty(indexed=False) |
| 30 # Error message and reason, if any. | 32 # Error message and reason, if any. |
| 31 error = ndb.JsonProperty(indexed=False) | 33 error = ndb.JsonProperty(indexed=False) |
| 34 # The last buildbucket build response received. |
| 35 last_buildbucket_response = ndb.JsonProperty(indexed=False, compressed=True) |
| 32 | 36 |
| 33 # TODO(lijeffrey): We may want to determine whether or not a try job | 37 # TODO(lijeffrey): We may want to determine whether or not a try job |
| 34 # was triggered as a redo of another if the first failed to find a culprit. | 38 # was triggered as a redo of another if the first failed to find a culprit. |
| 35 # For example, if passing compile targets yields no results, a redo without | 39 # For example, if passing compile targets yields no results, a redo without |
| 36 # compile targets may be attempted to find the culprit CL and the occurrence | 40 # compile targets may be attempted to find the culprit CL and the occurrence |
| 37 # documented in a queryable manner. | 41 # documented in a queryable manner. |
| 38 | 42 |
| 39 @staticmethod | 43 @staticmethod |
| 40 def _CreateKey(build_id): # pragma: no cover | 44 def _CreateKey(build_id): # pragma: no cover |
| 41 return ndb.Key('WfTryJobData', build_id) | 45 return ndb.Key('WfTryJobData', build_id) |
| 42 | 46 |
| 43 @staticmethod | 47 @staticmethod |
| 44 def Create(build_id): # pragma: no cover | 48 def Create(build_id): # pragma: no cover |
| 45 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) | 49 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) |
| 46 | 50 |
| 47 @staticmethod | 51 @staticmethod |
| 48 def Get(build_id): # pragma: no cover | 52 def Get(build_id): # pragma: no cover |
| 49 return WfTryJobData._CreateKey(build_id).get() | 53 return WfTryJobData._CreateKey(build_id).get() |
| 50 | 54 |
| OLD | NEW |