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

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

Issue 2608853002: [Findit] Adding suspected CL to master flake analysis in preparation for try jobs (Closed)
Patch Set: Rebase 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 32289d3acb5b727fdafef5748cccea64b06e4cea..81ca87cf5e5c8d91ddc76a18ad2a947b09982989 100644
--- a/appengine/findit/model/flake/master_flake_analysis.py
+++ b/appengine/findit/model/flake/master_flake_analysis.py
@@ -3,15 +3,19 @@
# found in the LICENSE file.
import base64
+import logging
from google.appengine.ext import ndb
+from gae_libs.http.http_client_appengine import HttpClientAppengine
+from gae_libs.gitiles.cached_gitiles_repository import CachedGitilesRepository
from gae_libs.model.versioned_model import VersionedModel
from model import result_status
from model import triage_status
from model.base_analysis import BaseAnalysis
from model.base_build_model import BaseBuildModel
from model.base_triaged_model import TriagedModel
+from model.flake.flake_suspected_cl import FlakeSuspectedCL
from model.flake.flake_swarming_task import FlakeSwarmingTaskData
@@ -30,6 +34,10 @@ class MasterFlakeAnalysis(
BaseAnalysis, BaseBuildModel, VersionedModel, TriagedModel):
"""Represents an analysis of a flaky test on a Waterfall test cycle."""
+ GIT_REPO = CachedGitilesRepository(
+ HttpClientAppengine(),
+ 'https://chromium.googlesource.com/chromium/src.git')
+
@ndb.ComputedProperty
def step_name(self):
return self.key.pairs()[0][1].split('/')[3]
@@ -95,6 +103,27 @@ class MasterFlakeAnalysis(
else:
self.result_status = result_status.FOUND_INCORRECT
+ def UpdateSuspectedCL(self, repo_name, revision):
+ """Sets suspected_cl information."""
+ change_log = self.GIT_REPO.GetChangeLog(revision)
stgao 2017/01/05 21:28:03 It seems better to move this out to the caller cod
lijeffrey 2017/01/06 05:18:16 Sounds good, by moving change_log outside to the c
+
+ if change_log:
+ code_review_url = change_log.code_review_url or change_log.commit_url
stgao 2017/01/05 21:28:03 See comment above.
lijeffrey 2017/01/06 05:18:16 Done.
+ suspected_cl = FlakeSuspectedCL.Create(
+ repo_name, revision, change_log.commit_position, code_review_url)
+ self.suspected_cl = suspected_cl
+ else: # pragma: no cover
+ logging.error('Unable to retrieve change logs for %s', revision)
+
+ def GetSuspectedFlakeDataPoint(self):
+ """Gets the corresponding data point to the suspected flake build."""
+ if self.suspected_flake_build_number is not None:
+ for data_point in self.data_points:
+ if data_point.build_number == self.suspected_flake_build_number:
+ return data_point
+
+ return None
+
def Reset(self):
super(MasterFlakeAnalysis, self).Reset()
self.original_master_name = None
@@ -109,6 +138,8 @@ class MasterFlakeAnalysis(
self.correct_culprit = None
self.algorithm_parameters = None
self.suspected_flake_build_number = None
+ self.suspected_cl = None
+ self.try_job_status = None
self.data_points = []
self.result_status = None
@@ -158,6 +189,13 @@ class MasterFlakeAnalysis(
# The suspected build number to have introduced the flakiness.
suspected_flake_build_number = ndb.IntegerProperty()
+ # The suspected CL associated with the try job results, if any.
+ suspected_cl = ndb.LocalStructuredProperty(FlakeSuspectedCL)
+
+ # The status of the try job, if any. None if no suspected flake build number
+ # yet.
+ try_job_status = ndb.IntegerProperty(indexed=False)
+
# The data points used to plot the flakiness graph build over build.
data_points = ndb.LocalStructuredProperty(
DataPoint, repeated=True, compressed=True)

Powered by Google App Engine
This is Rietveld 408576698