Chromium Code Reviews| 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)) |