def test_build_graph(self, fetch_allthethings_data): """Test if the graph has the correct format.""" fetch_allthethings_data.return_value = ALLTHETHINGS builders = list_builders( repo_name='try') # XXX: why are we only choosing try? new_graph = build_tests_per_platform_graph(builders) assert new_graph == GRAPH_RESULT
def test_build_graph(self, fetch_allthethings_data): """Test if the graph has the correct format.""" fetch_allthethings_data.return_value = MOCK_ALLTHETHINGS builders = list_builders(repo_name='repo') builders.sort() expected = { 'debug': { 'platform1': { 'tests': ['mochitest-1'], 'Platform1 repo leak test build': ['Platform1 repo debug test mochitest-1'] } }, 'opt': { 'platform1': { 'tests': ['mochitest-1', 'tp5o'], 'Platform1 repo build': [ 'Platform1 repo opt test mochitest-1', 'Platform1 repo talos tp5o' ] } } } self.assertEquals(build_tests_per_platform_graph(builders), expected)
def load_graph(generateNew=False): global BUILDERS_GRAPH if generateNew is True or not os.path.isfile(GRAPH_JSON_FILENAME): BUILDERS_GRAPH = build_tests_per_platform_graph(builders=list_builders()) else: with open(GRAPH_JSON_FILENAME) as data_file: BUILDERS_GRAPH = json.load(data_file) save_graph_to_json(BUILDERS_GRAPH)
def determine_missing_jobs(self, repo_name, revision, considered_list_of_builders=None): if considered_list_of_builders is None: considered_list_of_builders = list_builders(repo_name=repo_name) considered_list_of_builders = set(considered_list_of_builders) coalesced_jobs = self._select_jobs_with_specified_status( repo_name=repo_name, revision=revision, status=COALESCED, considered_list_of_builders=considered_list_of_builders) missing_jobs = self._select_missing_jobs( repo_name=repo_name, revision=revision, considered_list_of_builders=considered_list_of_builders) return missing_jobs + coalesced_jobs
def trigger_missing_jobs_for_revision(repo_name, revision, dry_run=False): """ Trigger missing jobs for a given revision. Jobs containing 'b2g' or 'pgo' in their buildername will not be triggered. """ builders_for_repo = list_builders(repo_name=repo_name) for buildername in builders_for_repo: trigger_range( buildername=buildername, revisions=[revision], times=1, dry_run=dry_run, extra_properties={"mozci_request": {"type": "trigger_missing_jobs_for_revision"}}, )
def determine_missing_jobs(self, repo_name, revision, considered_list_of_builders=None): if considered_list_of_builders is None: considered_list_of_builders = list_builders(repo_name=repo_name) considered_list_of_builders = set(considered_list_of_builders) coalsced_jobs = self._select_jobs_with_specified_status( repo_name=repo_name, revision=revision, status=COALESCED, considered_list_of_builders=considered_list_of_builders) missing_jobs = self._select_missing_jobs( repo_name=repo_name, revision=revision, considered_list_of_builders=considered_list_of_builders) return missing_jobs + coalsced_jobs
def trigger_missing_jobs_for_revision(repo_name, revision, dry_run=False): """ Trigger missing jobs for a given revision. Jobs containing 'b2g' or 'pgo' in their buildername will not be triggered. """ builders_for_repo = list_builders(repo_name=repo_name) for buildername in builders_for_repo: trigger_range(buildername=buildername, revisions=[revision], times=1, dry_run=dry_run, extra_properties={ 'mozci_request': { 'type': 'trigger_missing_jobs_for_revision' } })
def trigger_missing_jobs_for_revision(self, repo_name, revision, dry_run=False, trigger_build_if_missing=True): """ Trigger missing jobs for a given revision. Jobs containing 'b2g' or 'pgo' in their buildername will not be triggered. """ builders_for_repo = list_builders(repo_name=repo_name) for buildername in builders_for_repo: trigger_range( buildername=buildername, revisions=[revision], times=1, dry_run=dry_run, extra_properties={ 'mozci_request': { 'type': 'trigger_missing_jobs_for_revision' } }, trigger_build_if_missing=trigger_build_if_missing )
def test_build_graph(self, fetch_allthethings_data): """Test if the graph has the correct format.""" fetch_allthethings_data.return_value = MOCK_ALLTHETHINGS builders = list_builders(repo_name='repo') builders.sort() expected = { 'debug': { 'platform1': { 'tests': ['mochitest-1'], 'Platform1 repo leak test build': [ 'Platform1 repo debug test mochitest-1'] } }, 'opt': { 'platform1': { 'tests': ['mochitest-1', 'tp5o'], 'Platform1 repo build': [ 'Platform1 repo opt test mochitest-1', 'Platform1 repo talos tp5o'] } } } self.assertEquals(build_tests_per_platform_graph(builders), expected)
def query_builders(repo_name=None): """Return list of all builders or the builders associated to a repo.""" return list_builders(repo_name)
"""This script writes a mapping from platforms to tests that run in it to graph.json.""" import json from mozci.platforms import build_tests_per_platform_graph, list_builders from mozci.utils.transfer import path_to_file if __name__ == '__main__': with open(path_to_file('graph.json'), 'w') as f: graph = build_tests_per_platform_graph(builders=list_builders( repo_name='try')) json.dump(graph, f, sort_keys=True, indent=4, separators=(',', ': '))
"""This script writes a mapping from platforms to tests that run in it to graph.json.""" import json from mozci.platforms import build_tests_per_platform_graph, list_builders from mozci.utils.transfer import path_to_file if __name__ == '__main__': with open(path_to_file('graph.json'), 'w') as f: graph = build_tests_per_platform_graph( builders=list_builders()) json.dump(graph, f, sort_keys=True, indent=4, separators=(',', ': '))
def test_build_graph(self, fetch_allthethings_data): """Test if the graph has the correct format.""" fetch_allthethings_data.return_value = ALLTHETHINGS builders = list_builders(repo_name='try') # XXX: why are we only choosing try? new_graph = build_tests_per_platform_graph(builders) assert new_graph == GRAPH_RESULT
from mozci.platforms import ( build_tests_per_platform_graph, list_builders ) import json print json.dumps( build_tests_per_platform_graph( list_builders(repo_name='try') ), indent=4, sort_keys=True )
"""This script writes a mapping from platforms to tests that run in it to graph.json.""" import json from mozci.platforms import build_tests_per_platform_graph, list_builders from mozci.utils.transfer import path_to_file if __name__ == '__main__': with open(path_to_file('graph.json'), 'w') as f: graph = build_tests_per_platform_graph(builders=list_builders()) json.dump(graph, f, sort_keys=True, indent=4, separators=(',', ': '))