Chromium Code Reviews| Index: appengine/findit/model/wf_suspected_cl.py |
| diff --git a/appengine/findit/model/wf_suspected_cl.py b/appengine/findit/model/wf_suspected_cl.py |
| index 4c4caac1f1d715c584f5a98b7dec0722bcb02340..ee7e25e8377751e96f11f7c951f073265362e09a 100644 |
| --- a/appengine/findit/model/wf_suspected_cl.py |
| +++ b/appengine/findit/model/wf_suspected_cl.py |
| @@ -4,52 +4,74 @@ |
| from google.appengine.ext import ndb |
| +from model.base_cl import BaseCL |
| -class WfSuspectedCL(ndb.Model): |
| + |
| +class WfSuspectedCL(BaseCL): |
| """Represents suspected cl that causes failures on Chromium waterfall builds. |
| 'Wf' is short for waterfall. |
| """ |
| - # Repo or project name of the suspected CL, eg: chromium, etc. |
| - repo_name = ndb.StringProperty(indexed=True) |
| - |
| - # The Git hash revision of the suspected CL. |
| - revision = ndb.StringProperty(indexed=False) |
| - |
| - # The commit position of the suspected CL. |
| - # Might not be available for some repo. |
| - commit_position = ndb.IntegerProperty(indexed=False) |
| - |
| - # The list of builds in which the suspected CL caused some breakage. |
| + # The dict of builds in which the suspected CL caused some breakage. |
| + # The dict will look like: |
| + # { |
| + # 'm1/b1/123': [ |
| + # { |
| + # 'failure_type': 'compile', |
| + # 'failures': None, |
| + # 'status': CORRECT, |
| + # 'approach': BOTH, |
| + # 'top_score': 5, |
| + # 'Confidence': 97.9 |
| + # } |
| + # ], |
| + # 'm2/b2/234': [ |
| + # { |
| + # 'failure_type': 'test', |
| + # 'failures': { |
| + # 's1': ['t1', 't2'] |
| + # }, |
| + # 'status': CORRECT, |
| + # 'approach': BOTH, |
| + # 'top_score': None, |
| + # 'Confidence': 80.0 |
| + # }, |
| + # { |
| + # 'failure_type': 'test', |
| + # 'failures': { |
| + # 's1': ['t3'] |
| + # }, |
| + # 'status': INCORRECT, |
| + # 'approach': HEURISTIC, |
| + # 'top_score': 2, |
| + # 'Confidence': 50.5 |
| + # }, |
| + # { |
| + # 'failure_type': 'test', |
| + # 'failures': { |
| + # 's2': [] |
| + # }, |
| + # 'status': INCORRECT, |
| + # 'approach': HEURISTIC, |
| + # 'top_score': 1, |
| + # 'Confidence': 30.7 |
| + # } |
| + # ] |
| + # } |
| builds = ndb.JsonProperty(indexed=False) |
| # Is the suspected CL the culprit or not. |
| - is_culprit = ndb.BooleanProperty(indexed=True, default=None) |
| + # If not triaged, the status would be None. |
| + # 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.
|
| + # suspected_cl_status.INCORRECT, suspected_cl_status.PARTIALLY_CORRECT and |
| + # suspected_cl_status.PARTIALLY_TRIAGED, |
|
lijeffrey
2016/09/08 22:09:25
nit: . instead of ,
chanli
2016/09/08 22:32:29
Done.
|
| + status = ndb.IntegerProperty(indexed=True, default=None) |
| - # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. |
| + # From which approach do we get this suspected CL: |
| + # analysis_approach_type.HEURISTIC, analysis_approach_type.TRY_JOB or |
| + # analysis_approach_type.BOTH. |
| approach = ndb.IntegerProperty(indexed=True) |
| - # Failure type: failure_type.COMPILE or failure_type.TEST. |
| - failure_type = ndb.IntegerProperty(indexed=True) |
| - |
| - @property |
| - def project_name(self): |
| - return self.repo_name |
| - |
| - @classmethod |
| - def _CreateKey(cls, repo_name, revision): # pragma: no cover |
| - return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) |
| - |
| - @classmethod |
| - def Create(cls, repo_name, revision, commit_position): # pragma: no cover |
| - instance = cls(key=cls._CreateKey(repo_name, revision)) |
| - instance.repo_name = repo_name |
| - instance.revision = revision |
| - instance.commit_position = commit_position |
| - instance.builds = [] |
| - return instance |
| - |
| - @classmethod |
| - def Get(cls, repo_name, revision): # pragma: no cover |
| - return cls._CreateKey(repo_name, revision).get() |
| + # Failure type: failure_type.COMPILE, failure_type.TEST or failure_type.BOTH. |
| + failure_type = ndb.IntegerProperty(indexed=True) |