Chromium Code Reviews| Index: appengine/findit/model/flake/master_flake_analysis.py |
| diff --git a/appengine/findit/model/flake/master_flake_analysis.py b/appengine/findit/model/flake/master_flake_analysis.py |
| index 9add50b113071c2c6791adc03e3efcdd80273215..306e354264babef711d79ba22dda5c2e957bb9d6 100644 |
| --- a/appengine/findit/model/flake/master_flake_analysis.py |
| +++ b/appengine/findit/model/flake/master_flake_analysis.py |
| @@ -17,15 +17,72 @@ from model.flake.flake_swarming_task import FlakeSwarmingTaskData |
| class DataPoint(ndb.Model): |
| + # The build number corresponding to this data point. Only relevant if this |
| + # data point is generated as the result of a flake swarming task. |
|
chanli
2017/01/13 00:47:32
Should we mention this is relevant for build level
lijeffrey
2017/01/13 01:39:23
Done.
|
| build_number = ndb.IntegerProperty(indexed=False) |
| + |
| + # The pass rate of the test when run against this commit. |
| pass_rate = ndb.FloatProperty(indexed=False) |
| + |
| + # The ID of the swarming task responsible for generating this data. |
| task_id = ndb.StringProperty(indexed=False) |
| + |
| + # The git position of this data point. |
|
chanli
2017/01/13 00:47:33
I don't think git position is the right way to cal
lijeffrey
2017/01/13 01:39:23
Done.
|
| commit_position = ndb.IntegerProperty(indexed=False) |
| + |
| + # The git hash of this data point. |
| git_hash = ndb.StringProperty(indexed=False) |
| + |
| + # The commit position of the build preceding this one. Only relevant if this |
| + # data point is generated as the result of a flake swarming taask. |
|
chanli
2017/01/13 00:47:33
Nit: taask -> task
lijeffrey
2017/01/13 01:39:23
Done.
|
| previous_build_commit_position = ndb.IntegerProperty(indexed=False) |
| + |
| + # The git hash of the data point 1 build before this one. Only relevant if |
| + # this data point is generated as the result of a flake swarming task. |
| previous_build_git_hash = ndb.StringProperty(indexed=False) |
|
chanli
2017/01/13 00:47:33
Maybe now is a little late.... But why do we need
lijeffrey
2017/01/13 01:39:23
git hash is the useful one, previous build commit
|
| + |
| + # The list of revisions between this build and the previous build. Only |
| + # relevant if this data point is generated as the result of a flake swarming |
| + # task. |
| blame_list = ndb.StringProperty(repeated=True) |
| + # The ID of the try job that generated this data point, if any. |
| + try_job_id = ndb.StringProperty(indexed=False) |
|
chanli
2017/01/13 00:47:33
As we discussed offline, maybe remove try_job_id f
lijeffrey
2017/01/13 01:39:23
Done.
|
| + |
| + # The URL to the try job that generated this data point, if any. |
| + try_job_url = ndb.StringProperty(indexed=False) |
| + |
| + def GetCommitPosition(self, revision): |
|
chanli
2017/01/13 00:47:32
I think this function is a little hacky... Althoug
lijeffrey
2017/01/13 01:39:23
Unfortunately blame_list only contains revisions a
|
| + """Gets the commit position of a revision within blame_list. |
| + |
| + Args: |
| + revision (str): The revision to search for. |
| + |
| + Returns: |
| + commit_position (int): The calculated commit position of revision. |
| + """ |
| + assert revision in self.blame_list |
| + |
| + for i in range(0, len(self.blame_list)): # pragma: no branch |
| + if revision == self.blame_list[i]: |
| + return i + self.previous_build_commit_position + 1 |
| + |
| + def GetRevisionAtCommitPosition(self, commit_position): |
| + """Gets the corresponding revision to commit_position. |
| + |
| + Args: |
| + commit_position (int): The commit position for which to find the |
| + corresponding revision within self.blame_list. |
| + |
| + Returns: |
| + revision (str): The git revision corresponding to commit_position. |
| + """ |
| + length = len(self.blame_list) |
| + assert (commit_position > self.commit_position - length and |
| + commit_position <= self.commit_position) |
| + return self.blame_list[ |
| + length - (self.commit_position - commit_position) - 1] |
| + |
| class MasterFlakeAnalysis( |
| BaseAnalysis, BaseBuildModel, VersionedModel, TriagedModel): |
| @@ -176,7 +233,7 @@ class MasterFlakeAnalysis( |
| # The status of try jobs, if any. None if try jobs have not been triggered. |
| # Status should be PENDING or STARTED when the first try job is triggered, |
| # and COMPLETED when the last one finishes. If any try job ends in error, |
| - # status will be ERROR. |
| + # status will be ERROR. |
| try_job_status = ndb.IntegerProperty(indexed=False) |
| # The data points used to plot the flakiness graph build over build. |