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

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

Issue 2411893002: [Findit] Adding metadata for manually vs automatically triggered flake analyses (Closed)
Patch Set: Addressing comments 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
« no previous file with comments | « appengine/findit/waterfall/flake/trigger_flake_analyses_pipeline.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5db2921414b8d36073f788a68b1dd49b05dc7b6b
--- /dev/null
+++ b/appengine/findit/waterfall/flake/triggering_sources.py
@@ -0,0 +1,33 @@
+# 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's UI.
+FINDIT_UI = 1
+
+# An analysis was triggered using Findit's API.
+FINDIT_API = 2
+
+# An analysis was triggered using Findit's normal analysis pipeline.
+FINDIT_PIPELINE = 3
+
+
+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_UI: 'Findit UI',
+ FINDIT_API: 'Findit API',
+ FINDIT_PIPELINE: 'Findit pipeline'
+ }
+ 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))
« no previous file with comments | « appengine/findit/waterfall/flake/trigger_flake_analyses_pipeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698