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

Unified Diff: appengine/findit/waterfall/suspected_cl_util.py

Issue 2230103002: [Findit] Pipeline change to save suspected cls to data store. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@0808-resubmit-suspected_cl_model
Patch Set: . Created 4 years, 4 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/waterfall/suspected_cl_util.py
diff --git a/appengine/findit/waterfall/suspected_cl_util.py b/appengine/findit/waterfall/suspected_cl_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..c77e5d5aa95462ad6f289441f4a3ed76dd08d2ec
--- /dev/null
+++ b/appengine/findit/waterfall/suspected_cl_util.py
@@ -0,0 +1,31 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from google.appengine.ext import ndb
+
+from model import analysis_approach_type
+from model.wf_suspected_cl import WfSuspectedCL
+
+
+@ndb.transactional
+def UpdateSuspectedCL(
+ approach, master_name, builder_name, build_number, failure_type,
+ repo_name, revision, commit_position):
+
+ suspected_cl = (
+ WfSuspectedCL.Get(repo_name, revision) or
lijeffrey 2016/08/17 19:31:11 nit: 4 spaces on new lines
chanli 2016/09/12 20:56:15 Done.
+ WfSuspectedCL.Create(repo_name, revision, commit_position))
+
+ if suspected_cl.approach is None:
+ suspected_cl.approach = approach
+ elif suspected_cl.approach != approach:
+ suspected_cl.approach = analysis_approach_type.BOTH
+
+ suspected_cl.failure_type = suspected_cl.failure_type or failure_type
+
+ build_info = [master_name, builder_name, build_number]
+ if build_info not in suspected_cl.builds:
+ suspected_cl.builds.append(build_info)
+
+ suspected_cl.put()

Powered by Google App Engine
This is Rietveld 408576698