def generate_tc_graph_from_builders(builders, repo_name, revision): """ Return TC graph based on a list of builders. :param builders: List of builder names :type builders: list :param repo_name: push revision :type repo_name: str :param revision: push revision :type revision: str :return: TC graph :rtype: dict """ return generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tc_tasks_from_builders( builders=builders, repo_name=repo_name, revision=revision ), metadata=generate_metadata( repo_name=repo_name, revision=revision, name='Mozci BBB graph' ) )
def trigger_builders_based_on_task_id(repo_name, revision, task_id, builders, *args, **kwargs): """ Create a graph of tasks which will use a TC task as their parent task. :param repo_name The name of a repository e.g. mozilla-inbound :type repo_name: str :param revision: push revision :type revision: str :returns: Result of scheduling a TC graph :rtype: dict """ if not builders: return None if type(builders) != list: raise MozciError("builders must be a list") # If the task_id is of a task which is running we want to extend the graph # instead of submitting an independent one task = get_task(task_id) task_graph_id = task['taskGroupId'] state = get_task_graph_status(task_graph_id) builders_graph, _ = buildbot_graph_builder(builders, revision) if state == "running": required_task_ids = [task_id] else: required_task_ids = [] task_graph = generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tasks( repo_name=repo_name, revision=revision, builders_graph=builders_graph, # This points to which parent to grab artifacts from parent_task_id=task_id, # This creates dependencies on other tasks required_task_ids=required_task_ids, ), metadata=generate_metadata( repo_name=repo_name, revision=revision, name='Mozci BBB graph' ) ) if state == "running": result = extend_task_graph(task_graph_id, task_graph) else: result = schedule_graph(task_graph, *args, **kwargs) LOG.info("Result from scheduling: %s" % result) return result
def trigger_builders_based_on_task_id(repo_name, revision, task_id, builders, *args, **kwargs): """ Create a graph of tasks which will use a TC task as their parent task. :param repo_name The name of a repository e.g. mozilla-inbound :type repo_name: str :param revision: push revision :type revision: str :returns: Result of scheduling a TC graph :rtype: dict """ if not builders: return None if type(builders) != list: raise MozciError("builders must be a list") # If the task_id is of a task which is running we want to extend the graph # instead of submitting an independent one task = get_task(task_id) task_graph_id = task['taskGroupId'] state = get_task_graph_status(task_graph_id) builders_graph, _ = buildbot_graph_builder(builders, revision) if state == "running": required_task_ids = [task_id] else: required_task_ids = [] task_graph = generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tasks( repo_name=repo_name, revision=revision, builders_graph=builders_graph, # This points to which parent to grab artifacts from parent_task_id=task_id, # This creates dependencies on other tasks required_task_ids=required_task_ids, ), metadata=generate_metadata(repo_name=repo_name, revision=revision, name='Mozci BBB graph')) if state == "running": result = extend_task_graph(task_graph_id, task_graph) else: result = schedule_graph(task_graph, *args, **kwargs) LOG.info("Result from scheduling: %s" % result) return result
def generate_builders_tc_graph(repo_name, revision, builders_graph, *args, **kwargs): """Return TaskCluster graph based on builders_graph. NOTE: We currently only support depending on one single parent. :param repo_name The name of a repository e.g. mozilla-inbound :type repo_name: str :param revision: push revision :type revision: str :param builders_graph: It is a graph made up of a dictionary where each key is a Buildbot buildername. The value for each key is either None or another graph of dependent builders. :type builders_graph: dict :returns: return None or a valid taskcluster task graph. :rtype: dict """ LOG.debug("Generating TaskCluster BBB graph...") if builders_graph is None: return None metadata = kwargs.get('metadata') if metadata is None: metadata = generate_metadata(repo_name=repo_name, revision=revision, name='Mozci BBB graph') # This is the initial task graph which we're defining task_graph = generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tasks( repo_name=repo_name, revision=revision, builders_graph=builders_graph, metadata=metadata, ), metadata=metadata ) return task_graph
def generate_builders_tc_graph(repo_name, revision, builders_graph, *args, **kwargs): """Return TaskCluster graph based on builders_graph. NOTE: We currently only support depending on one single parent. :param repo_name The name of a repository e.g. mozilla-inbound :type repo_name: str :param revision: push revision :type revision: str :param builders_graph: It is a graph made up of a dictionary where each key is a Buildbot buildername. The value for each key is either None or another graph of dependent builders. :type builders_graph: dict :returns: return None or a valid taskcluster task graph. :rtype: dict """ LOG.debug("Generating TaskCluster BBB graph...") if builders_graph is None: return None metadata = kwargs.get('metadata') if metadata is None: metadata = generate_metadata(repo_name=repo_name, revision=revision, name='Mozci BBB graph') # This is the initial task graph which we're defining task_graph = generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tasks( repo_name=repo_name, revision=revision, builders_graph=builders_graph, metadata=metadata, ), metadata=metadata) return task_graph
def generate_tc_graph_from_builders(builders, repo_name, revision): """ Return TC graph based on a list of builders. :param builders: List of builder names :type builders: list :param repo_name: push revision :type repo_name: str :param revision: push revision :type revision: str :return: TC graph :rtype: dict """ return generate_task_graph( scopes=[ # This is needed to define tasks which take advantage of the BBB 'queue:define-task:buildbot-bridge/buildbot-bridge', ], tasks=_generate_tc_tasks_from_builders(builders=builders, repo_name=repo_name, revision=revision), metadata=generate_metadata(repo_name=repo_name, revision=revision, name='Mozci BBB graph'))