| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Determines support level for different steps for masters.""" | 5 """Determines support level for different steps for masters.""" |
| 6 | 6 |
| 7 from model import wf_config | 7 from model.wf_config import FinditConfig |
| 8 | 8 |
| 9 # Explicitly list unsupported masters. Additional work might be needed in order | 9 # Explicitly list unsupported masters. Additional work might be needed in order |
| 10 # to support them. | 10 # to support them. |
| 11 _UNSUPPORTED_MASTERS = [ | 11 _UNSUPPORTED_MASTERS = [ |
| 12 'chromium.lkgr', # Disable as results are not showed on Sheriff-o-Matic. | 12 'chromium.lkgr', # Disable as results are not showed on Sheriff-o-Matic. |
| 13 'chromium.gpu', # Disable as too many false positives. | 13 'chromium.gpu', # Disable as too many false positives. |
| 14 | 14 |
| 15 'chromium.memory.fyi', | 15 'chromium.memory.fyi', |
| 16 'chromium.gpu.fyi', | 16 'chromium.gpu.fyi', |
| 17 | 17 |
| 18 'chromium.perf', | 18 'chromium.perf', |
| 19 ] | 19 ] |
| 20 | 20 |
| 21 | 21 |
| 22 def MasterIsSupported(master_name): | 22 def MasterIsSupported(master_name): |
| 23 """Return True if the given master is supported, otherwise False.""" | 23 """Return True if the given master is supported, otherwise False.""" |
| 24 return master_name in wf_config.Settings().masters_to_blacklisted_steps.keys() | 24 return master_name in FinditConfig.Get().masters_to_blacklisted_steps.keys() |
| 25 | 25 |
| 26 | 26 |
| 27 def StepIsSupportedForMaster(step_name, master_name): | 27 def StepIsSupportedForMaster(step_name, master_name): |
| 28 """Determines whether or not a step is supported for the given build master. | 28 """Determines whether or not a step is supported for the given build master. |
| 29 | 29 |
| 30 Args: | 30 Args: |
| 31 step_name: The name of the step to check. | 31 step_name: The name of the step to check. |
| 32 master_name: The name of the build master to check. | 32 master_name: The name of the build master to check. |
| 33 | 33 |
| 34 Returns: | 34 Returns: |
| 35 True if Findit supports analyzing the failure, False otherwise. If a master | 35 True if Findit supports analyzing the failure, False otherwise. If a master |
| 36 is not supported, then neither are any of its steps. | 36 is not supported, then neither are any of its steps. |
| 37 """ | 37 """ |
| 38 config = wf_config.Settings() | 38 masters_to_blacklisted_steps = FinditConfig.Get().masters_to_blacklisted_steps |
| 39 masters_to_blacklisted_steps = config.masters_to_blacklisted_steps | |
| 40 blacklisted_steps = masters_to_blacklisted_steps.get(master_name) | 39 blacklisted_steps = masters_to_blacklisted_steps.get(master_name) |
| 41 if blacklisted_steps is None: | 40 if blacklisted_steps is None: |
| 42 return False | 41 return False |
| 43 | 42 |
| 44 return step_name not in blacklisted_steps | 43 return step_name not in blacklisted_steps |
| 45 | 44 |
| 46 | 45 |
| 47 def GetTrybotForWaterfallBuilder(wf_mastername, wf_buildername): | 46 def GetTrybotForWaterfallBuilder(wf_mastername, wf_buildername): |
| 48 """Returns trybot mastername and buildername for the given waterfall builder. | 47 """Returns trybot mastername and buildername for the given waterfall builder. |
| 49 | 48 |
| 50 Args: | 49 Args: |
| 51 wf_mastername: The mastername of a waterfall builder. | 50 wf_mastername: The mastername of a waterfall builder. |
| 52 wf_buildername: The buildername of a waterfall builder. | 51 wf_buildername: The buildername of a waterfall builder. |
| 53 | 52 |
| 54 Returns: | 53 Returns: |
| 55 (tryserver_mastername, tryserver_buildername) | 54 (tryserver_mastername, tryserver_buildername) |
| 56 The trybot mastername and buildername to re-run compile in exactly the same | 55 The trybot mastername and buildername to re-run compile in exactly the same |
| 57 configuration as the given waterfall builder. If the given waterfall builder | 56 configuration as the given waterfall builder. If the given waterfall builder |
| 58 is not supported yet, (None, None) is returned instead. | 57 is not supported yet, (None, None) is returned instead. |
| 59 """ | 58 """ |
| 60 config = wf_config.Settings() | 59 trybot_config = FinditConfig.Get().builders_to_trybots.get( |
| 61 trybot_config = config.builders_to_trybots.get( | |
| 62 wf_mastername, {}).get(wf_buildername, {}) | 60 wf_mastername, {}).get(wf_buildername, {}) |
| 63 return trybot_config.get('mastername'), trybot_config.get('buildername') | 61 return trybot_config.get('mastername'), trybot_config.get('buildername') |
| OLD | NEW |