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

Unified Diff: appengine/findit/waterfall/flake/triggering_sources.py

Issue 2411893002: [Findit] Adding metadata for manually vs automatically triggered flake analyses (Closed)
Patch Set: Created 4 years, 2 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/flake/triggering_sources.py
diff --git a/appengine/findit/waterfall/flake/triggering_sources.py b/appengine/findit/waterfall/flake/triggering_sources.py
new file mode 100644
index 0000000000000000000000000000000000000000..aecbf20345e495dfa3888866a3dc33bffca9b2f9
--- /dev/null
+++ b/appengine/findit/waterfall/flake/triggering_sources.py
@@ -0,0 +1,29 @@
+# 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.
+
+"""Sources for from where a flake analysis was triggered."""
+
+# An analysis was triggered directly through Findit.
stgao 2016/10/13 06:14:38 Do you mean the UI?
lijeffrey 2016/10/14 23:45:21 Done.
+FINDIT = 1
+
+# An analysis was triggered using Findit's API.
+FINDIT_API = 2
+
+
+def GetDescriptionForTriggeringSource(triggering_source, manually_triggered):
+ """Returns a human-readable description for where a request came from."""
+ template = 'The analysis was triggered %s through %s'
+
+ def _GetTriggeringSourceDescription(triggering_source):
+ source_to_description = {
+ FINDIT: 'Findit itself',
+ FINDIT_API: 'Findit API',
stgao 2016/10/13 06:14:38 What's the difference here? "Findit API" doesn't b
lijeffrey 2016/10/14 23:45:21 changed to FINDIT_UI, FINDIT_PIPELINE, and FINDIT_
+ }
+ return source_to_description.get(triggering_source, 'other/unknown source')
+
+ def _GetTriggeringUserDescription(manually_triggered):
+ return 'manually' if manually_triggered else 'automatically'
+
+ return template % (_GetTriggeringUserDescription(manually_triggered),
+ _GetTriggeringSourceDescription(triggering_source))

Powered by Google App Engine
This is Rietveld 408576698