Chromium Code Reviews| 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_cl import BaseCL | |
| 7 | 8 |
| 8 class WfSuspectedCL(ndb.Model): | 9 |
| 10 class WfSuspectedCL(BaseCL): | |
| 9 """Represents suspected cl that causes failures on Chromium waterfall builds. | 11 """Represents suspected cl that causes failures on Chromium waterfall builds. |
| 10 | 12 |
| 11 'Wf' is short for waterfall. | 13 'Wf' is short for waterfall. |
| 12 """ | 14 """ |
| 13 | 15 |
| 14 # Repo or project name of the suspected CL, eg: chromium, etc. | 16 # The dict of builds in which the suspected CL caused some breakage. |
| 15 repo_name = ndb.StringProperty(indexed=True) | 17 # The dict will look like: |
| 16 | 18 # { |
| 17 # The Git hash revision of the suspected CL. | 19 # 'm1/b1/123': [ |
| 18 revision = ndb.StringProperty(indexed=False) | 20 # { |
| 19 | 21 # 'failure_type': 'compile', |
| 20 # The commit position of the suspected CL. | 22 # 'failures': None, |
| 21 # Might not be available for some repo. | 23 # 'status': CORRECT, |
| 22 commit_position = ndb.IntegerProperty(indexed=False) | 24 # 'approach': BOTH, |
| 23 | 25 # 'top_score': 5, |
| 24 # The list of builds in which the suspected CL caused some breakage. | 26 # 'Confidence': 97.9 |
| 27 # } | |
| 28 # ], | |
| 29 # 'm2/b2/234': [ | |
| 30 # { | |
| 31 # 'failure_type': 'test', | |
| 32 # 'failures': { | |
| 33 # 's1': ['t1', 't2'] | |
| 34 # }, | |
| 35 # 'status': CORRECT, | |
| 36 # 'approach': BOTH, | |
| 37 # 'top_score': None, | |
| 38 # 'Confidence': 80.0 | |
| 39 # }, | |
| 40 # { | |
| 41 # 'failure_type': 'test', | |
| 42 # 'failures': { | |
| 43 # 's1': ['t3'] | |
| 44 # }, | |
| 45 # 'status': INCORRECT, | |
| 46 # 'approach': HEURISTIC, | |
| 47 # 'top_score': 2, | |
| 48 # 'Confidence': 50.5 | |
| 49 # }, | |
| 50 # { | |
| 51 # 'failure_type': 'test', | |
| 52 # 'failures': { | |
| 53 # 's2': [] | |
| 54 # }, | |
| 55 # 'status': INCORRECT, | |
| 56 # 'approach': HEURISTIC, | |
| 57 # 'top_score': 1, | |
| 58 # 'Confidence': 30.7 | |
| 59 # } | |
| 60 # ] | |
| 61 # } | |
| 25 builds = ndb.JsonProperty(indexed=False) | 62 builds = ndb.JsonProperty(indexed=False) |
| 26 | 63 |
| 27 # Is the suspected CL the culprit or not. | 64 # Is the suspected CL the culprit or not. |
| 28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) | 65 # If not triaged, the status would be None. |
| 66 # Other possible status are : suspected_cl_status.CORRECT, | |
|
lijeffrey
2016/09/08 22:09:24
nit: no space before :
chanli
2016/09/08 22:32:29
Done.
| |
| 67 # suspected_cl_status.INCORRECT, suspected_cl_status.PARTIALLY_CORRECT and | |
| 68 # suspected_cl_status.PARTIALLY_TRIAGED, | |
|
lijeffrey
2016/09/08 22:09:25
nit: . instead of ,
chanli
2016/09/08 22:32:29
Done.
| |
| 69 status = ndb.IntegerProperty(indexed=True, default=None) | |
| 29 | 70 |
| 30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. | 71 # From which approach do we get this suspected CL: |
| 72 # analysis_approach_type.HEURISTIC, analysis_approach_type.TRY_JOB or | |
| 73 # analysis_approach_type.BOTH. | |
| 31 approach = ndb.IntegerProperty(indexed=True) | 74 approach = ndb.IntegerProperty(indexed=True) |
| 32 | 75 |
| 33 # Failure type: failure_type.COMPILE or failure_type.TEST. | 76 # Failure type: failure_type.COMPILE, failure_type.TEST or failure_type.BOTH. |
| 34 failure_type = ndb.IntegerProperty(indexed=True) | 77 failure_type = ndb.IntegerProperty(indexed=True) |
| 35 | |
| 36 @property | |
| 37 def project_name(self): | |
| 38 return self.repo_name | |
| 39 | |
| 40 @classmethod | |
| 41 def _CreateKey(cls, repo_name, revision): # pragma: no cover | |
| 42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) | |
| 43 | |
| 44 @classmethod | |
| 45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover | |
| 46 instance = cls(key=cls._CreateKey(repo_name, revision)) | |
| 47 instance.repo_name = repo_name | |
| 48 instance.revision = revision | |
| 49 instance.commit_position = commit_position | |
| 50 instance.builds = [] | |
| 51 return instance | |
| 52 | |
| 53 @classmethod | |
| 54 def Get(cls, repo_name, revision): # pragma: no cover | |
| 55 return cls._CreateKey(repo_name, revision).get() | |
| OLD | NEW |