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

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

Issue 2510223003: [Findit] Fixing analysis mismatch in check flake (Closed)
Patch Set: Fixing nit Created 4 years, 1 month 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/flake_analysis_request.py
diff --git a/appengine/findit/model/flake/flake_analysis_request.py b/appengine/findit/model/flake/flake_analysis_request.py
index ccef2c153f1b39f22a12cc4501d3130f02b0c85f..4a7e689f9444779f516542da650a19969830b819 100644
--- a/appengine/findit/model/flake/flake_analysis_request.py
+++ b/appengine/findit/model/flake/flake_analysis_request.py
@@ -128,3 +128,31 @@ class FlakeAnalysisRequest(VersionedModel):
self.user_emails = other.user_emails
self.build_steps = other.build_steps
self.analyses = other.analyses
+
+ def _GetNormalizedConfigurationNames(self, master_name, builder_name):
+ for build_step in self.build_steps:
+ if ((build_step.master_name == master_name and
+ build_step.builder_name == builder_name) or
+ (build_step.wf_master_name == master_name and
+ build_step.wf_builder_name == builder_name)):
+ return build_step.wf_master_name, build_step.wf_builder_name
+ return None, None
+
+ def FindMatchingAnalysisForConfiguration(self, master_name, builder_name):
+ # Returns the analysis that corresponds to the requested master and builder.
+ normalized_master_name, normalized_builder_name = (
+ self._GetNormalizedConfigurationNames(master_name, builder_name))
+
+ if not normalized_master_name or not normalized_builder_name:
chanli 2016/11/18 21:02:46 Essentially _GetNormalizedConfigurationNames will
lijeffrey 2016/11/19 01:00:25 Not necessarily, build_step.master_name might != b
+ return None
+
+ for analysis_key in self.analyses:
+ components = analysis_key.pairs()[0][1].split('/')
stgao 2016/11/18 21:03:00 How about moving this logic to the MasterFlakeAnal
lijeffrey 2016/11/19 01:00:25 Done.
+ analysis_master_name = components[0]
+ analysis_builder_name = components[1]
+
+ if (analysis_master_name == normalized_master_name and
+ analysis_builder_name == normalized_builder_name):
+ return analysis_key.get()
+
+ return None

Powered by Google App Engine
This is Rietveld 408576698