Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3048)

Unified Diff: appengine/findit/model/flake/master_flake_analysis.py

Issue 2630433002: Findit] Flake Checker: Pipeline to trigger try jobs to identify flake culprits (Closed)
Patch Set: Clean up Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8d8149d88212eb5ed4a3009f2e512f927df11465 100644
--- a/appengine/findit/model/flake/master_flake_analysis.py
+++ b/appengine/findit/model/flake/master_flake_analysis.py
@@ -17,15 +17,74 @@ 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.
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.
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.
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)
+
+ # 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)
+
+ # The URL to the try job that generated this data point, if any.
+ try_job_url = ndb.StringProperty(indexed=False)
+
+ def GetCommitPosition(self, revision):
+ """Gets the commit position of a revision within blame_list.
+
+ It should be noted that commit position isn't guaranteed to be reliable
+ (monotonically increasing by increments of 1) 100% of the time. Should
stgao 2017/01/12 08:04:16 Per my meeting with Robbie, commit position is rel
lijeffrey 2017/01/12 09:52:52 Done.
+ this be the case, commit position should not be used.
+
+ 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 self.commit_position - i
+
+ 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.
+ """
+ assert (commit_position > self.commit_position - len(self.blame_list) and
+ commit_position <= self.commit_position)
+ return self.blame_list[self.commit_position - commit_position]
+
class MasterFlakeAnalysis(
BaseAnalysis, BaseBuildModel, VersionedModel, TriagedModel):

Powered by Google App Engine
This is Rietveld 408576698