Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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_build_model import BaseBuildModel | 7 from model.base_build_model import BaseBuildModel |
| 8 from model import wf_analysis_status | 8 from model import wf_analysis_status |
| 9 | 9 |
| 10 | 10 |
| 11 class WfTryJob(BaseBuildModel): | 11 class WfTryJob(BaseBuildModel): |
| 12 """Represents a tryjob results for a failed build. | 12 """Represents a tryjob results for a failed build. |
| 13 | 13 |
| 14 'Wf' is short for waterfall. | 14 'Wf' is short for waterfall. |
| 15 """ | 15 """ |
| 16 # A list of dict containing results and urls of each tryjob for compile. | 16 # A list of dict containing results and urls of each tryjob for compile. |
| 17 compile_results = ndb.JsonProperty(default=[], indexed=False, compressed=True) | 17 compile_results = ndb.JsonProperty(default=[], indexed=False, compressed=True) |
| 18 # TODO(chanli): Add test_results when add support for tryjobs for test. | 18 |
| 19 # A list of dict containing results and urls of each tryjob for test. | |
|
qyearsley
2016/01/17 03:43:12
Unrelated to this CL, but something that I notice:
chanli
2016/01/20 18:07:08
Done.
| |
| 20 test_results = ndb.JsonProperty(default=[], indexed=False, compressed=True) | |
| 19 | 21 |
| 20 # The status of the try job. | 22 # The status of the try job. |
| 21 status = ndb.IntegerProperty( | 23 status = ndb.IntegerProperty( |
| 22 default=wf_analysis_status.PENDING, indexed=False) | 24 default=wf_analysis_status.PENDING, indexed=False) |
| 23 | 25 |
| 24 @staticmethod | 26 @staticmethod |
| 25 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover | 27 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover |
| 26 return ndb.Key('WfTryJob', | 28 return ndb.Key('WfTryJob', |
| 27 BaseBuildModel.CreateBuildId( | 29 BaseBuildModel.CreateBuildId( |
| 28 master_name, builder_name, build_number)) | 30 master_name, builder_name, build_number)) |
| 29 | 31 |
| 30 @staticmethod | 32 @staticmethod |
| 31 def Create(master_name, builder_name, build_number): # pragma: no cover | 33 def Create(master_name, builder_name, build_number): # pragma: no cover |
| 32 return WfTryJob( | 34 return WfTryJob( |
| 33 key=WfTryJob._CreateKey(master_name, builder_name, build_number)) | 35 key=WfTryJob._CreateKey(master_name, builder_name, build_number)) |
| 34 | 36 |
| 35 @staticmethod | 37 @staticmethod |
| 36 def Get(master_name, builder_name, build_number): # pragma: no cover | 38 def Get(master_name, builder_name, build_number): # pragma: no cover |
| 37 return WfTryJob._CreateKey( | 39 return WfTryJob._CreateKey( |
| 38 master_name, builder_name, build_number).get() | 40 master_name, builder_name, build_number).get() |
| 39 | 41 |
| 40 @property | 42 @property |
| 41 def completed(self): | 43 def completed(self): |
| 42 return self.status in ( | 44 return self.status in ( |
| 43 wf_analysis_status.ANALYZED, wf_analysis_status.ERROR) | 45 wf_analysis_status.ANALYZED, wf_analysis_status.ERROR) |
| 44 | 46 |
| 45 @property | 47 @property |
| 46 def failed(self): | 48 def failed(self): |
| 47 return self.status == wf_analysis_status.ERROR | 49 return self.status == wf_analysis_status.ERROR |
| OLD | NEW |