| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Sources for from where a flake analysis was triggered.""" |
| 6 |
| 7 # An analysis was triggered directly through Findit's UI. |
| 8 FINDIT_UI = 1 |
| 9 |
| 10 # An analysis was triggered using Findit's API. |
| 11 FINDIT_API = 2 |
| 12 |
| 13 # An analysis was triggered using Findit's normal analysis pipeline. |
| 14 FINDIT_PIPELINE = 3 |
| 15 |
| 16 |
| 17 def GetDescriptionForTriggeringSource(triggering_source, manually_triggered): |
| 18 """Returns a human-readable description for where a request came from.""" |
| 19 template = 'The analysis was triggered %s through %s' |
| 20 |
| 21 def _GetTriggeringSourceDescription(triggering_source): |
| 22 source_to_description = { |
| 23 FINDIT_UI: 'Findit UI', |
| 24 FINDIT_API: 'Findit API', |
| 25 FINDIT_PIPELINE: 'Findit pipeline' |
| 26 } |
| 27 return source_to_description.get(triggering_source, 'other/unknown source') |
| 28 |
| 29 def _GetTriggeringUserDescription(manually_triggered): |
| 30 return 'manually' if manually_triggered else 'automatically' |
| 31 |
| 32 return template % (_GetTriggeringUserDescription(manually_triggered), |
| 33 _GetTriggeringSourceDescription(triggering_source)) |
| OLD | NEW |