def ShouldSkipTestTryJobs(wf_mastername, wf_buildername): """Returns True if test try jobs should be triggered. By default, test try jobs should be supported unless the master/builder specifies to bail out. Args: wf_mastername: The mastername of a waterfall builder. wf_buildername: The buildername of a waterfall builder. Returns: True if test try jobs are to be skipped, False otherwise. """ trybot_config = FinditConfig.Get().builders_to_trybots.get( wf_mastername, {}).get(wf_buildername, {}) return trybot_config.get('not_run_tests', False)
def UpdateUnitTestConfigSettings(self, config_property=None, override_data=None): """Sets up Findit's config for unit tests. Args: config_property: The name of the config property to update. override_data: A dict to override any default settings. """ config_data = DEFAULT_CONFIG_DATA if config_property and override_data: config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) config_data[config_property].update(override_data) FinditConfig.Get().Update(users.User(email='*****@*****.**'), True, **config_data)
def HandleGet(self): http_client = HttpClientAppengine() supported_masters = _GetSupportedMasters() main_waterfall_builders = _GetBuildersOnMasters( supported_masters, http_client) trybot_config = FinditConfig.Get().builders_to_trybots covered_builders = _GetCoveredBuilders(trybot_config) missing_builders = _GetDiffBetweenDicts(main_waterfall_builders, covered_builders) deprecated_builders = _GetDiffBetweenDicts(covered_builders, main_waterfall_builders) unused_variable_builders = _GetUnusedVariableBuilders( trybot_config, http_client) return { 'template': 'check_trybot_mapping.html', 'data': { 'missing': missing_builders, 'deprecated': deprecated_builders, 'unused_variable_builders': unused_variable_builders } }
def GetStepsForMastersRules(settings=None, version=None): if settings is None: settings = FinditConfig.Get(version) return (settings.steps_for_masters_rules or _ConvertOldMastersFormatToNew(settings.masters_to_blacklisted_steps))
def GetFlakeDetectionSettings(): return FinditConfig.Get().flake_detection_settings
def EnableStrictRegexForCompileLinkFailures(wf_mastername, wf_buildername): """Returns True if strict regex should be used for the given builder.""" trybot_config = FinditConfig.Get().builders_to_trybots.get( wf_mastername, {}).get(wf_buildername, {}) return trybot_config.get('strict_regex', False)
def _GetTrybotConfig(master, builder): trybot_config = _ConvertOldTrybotFormatToNew( FinditConfig.Get().builders_to_trybots) return trybot_config.get(master, {}).get(builder, {})
req = urllib2.Request(_MILO_MASTER_ENDPOINT, None, headers) f = urllib2.urlopen(req, json.dumps(values), timeout=60) except Exception as e: print( 'WARNING: Unable to reach builbot to retrieve trybot ' 'information') raise e data = _ProcessMiloData(f.read()) return [bot for bot in data.get('builders', {}).keys()] if __name__ == '__main__': remote_api.EnableRemoteApi(app_id='findit-for-me') trybots = FinditConfig.Get().builders_to_trybots steps_for_masters_rules = FinditConfig.Get().steps_for_masters_rules main_waterfall_cache = {} variable_builders_cache = defaultdict(list) tryservers = set() print 'Determining missing support...' supported_masters = steps_for_masters_rules.get('supported_masters', {}).keys() for master in supported_masters: print 'Master: %s' % master if not trybots.get(master): print 'Not found. Tryjobs for %s may not be supported.' % master print
def _GetSupportedMasters(): """Lists the supported main waterfall masters Findit runs analyses on.""" return FinditConfig.Get().steps_for_masters_rules.get( 'supported_masters', {}).keys()
return html if __name__ == '__main__': # Set up the Remote API to use services on the live App Engine. remote_api.EnableRemoteApi(app_id='findit-for-me') START_DATE = datetime.datetime(2016, 3, 1) END_DATE = datetime.datetime(2016, 4, 14) wf_analysis_query = WfTryJobData.query( WfTryJobData.request_time >= START_DATE, WfTryJobData.request_time < END_DATE) data_list = wf_analysis_query.fetch() masters_to_builders = FinditConfig.Get().builders_to_trybots data = _CategorizeTryJobData(data_list) full_report_list = _GetReportListForMastersAndBuilders( masters_to_builders, data, START_DATE, END_DATE) findit_tmp_dir = os.environ.get('TMP_DIR') if not findit_tmp_dir: findit_tmp_dir = os.getcwd() report_path = os.path.join(findit_tmp_dir, 'try_job_data_report.html') with open(report_path, 'w') as f: f.write(CreateHtmlPage(full_report_list, START_DATE, END_DATE)) print 'Try job metadata report available at file://%s' % report_path