| 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. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 # Number of commits in the revision range. | 24 # Number of commits in the revision range. |
| 25 regression_range_size = ndb.IntegerProperty(indexed=False) | 25 regression_range_size = ndb.IntegerProperty(indexed=False) |
| 26 # Number of commits analyzed to determine a culprit if any. | 26 # Number of commits analyzed to determine a culprit if any. |
| 27 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) | 27 number_of_commits_analyzed = ndb.IntegerProperty(indexed=False) |
| 28 # Culprit(s) determined to have caused the failure, if any. | 28 # Culprit(s) determined to have caused the failure, if any. |
| 29 culprits = ndb.JsonProperty(indexed=False) | 29 culprits = ndb.JsonProperty(indexed=False) |
| 30 # The url to the try job build page. | 30 # The url to the try job build page. |
| 31 try_job_url = ndb.StringProperty(indexed=False) | 31 try_job_url = ndb.StringProperty(indexed=False) |
| 32 # Error message and reason, if any. | 32 # Error message and reason, if any. |
| 33 error = ndb.JsonProperty(indexed=False) | 33 error = ndb.JsonProperty(indexed=False) |
| 34 # Error code if anything went wrong with the try job. |
| 35 error_code = ndb.IntegerProperty(indexed=True) |
| 34 # The last buildbucket build response received. | 36 # The last buildbucket build response received. |
| 35 last_buildbucket_response = ndb.JsonProperty(indexed=False, compressed=True) | 37 last_buildbucket_response = ndb.JsonProperty(indexed=False, compressed=True) |
| 36 | 38 |
| 37 # TODO(lijeffrey): We may want to determine whether or not a try job | |
| 38 # was triggered as a redo of another if the first failed to find a culprit. | |
| 39 # For example, if passing compile targets yields no results, a redo without | |
| 40 # compile targets may be attempted to find the culprit CL and the occurrence | |
| 41 # documented in a queryable manner. | |
| 42 | |
| 43 @staticmethod | 39 @staticmethod |
| 44 def _CreateKey(build_id): # pragma: no cover | 40 def _CreateKey(build_id): # pragma: no cover |
| 45 return ndb.Key('WfTryJobData', build_id) | 41 return ndb.Key('WfTryJobData', build_id) |
| 46 | 42 |
| 47 @staticmethod | 43 @staticmethod |
| 48 def Create(build_id): # pragma: no cover | 44 def Create(build_id): # pragma: no cover |
| 49 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) | 45 return WfTryJobData(key=WfTryJobData._CreateKey(build_id)) |
| 50 | 46 |
| 51 @staticmethod | 47 @staticmethod |
| 52 def Get(build_id): # pragma: no cover | 48 def Get(build_id): # pragma: no cover |
| 53 return WfTryJobData._CreateKey(build_id).get() | 49 return WfTryJobData._CreateKey(build_id).get() |
| 54 | 50 |
| OLD | NEW |