def label_summaries(self): """All label summaries combining retriggers. Returns: dict: A dictionary of the form {<label>: [<LabelSummary>]}. """ labels = defaultdict(list) for task in self.tasks: labels[task.label].append(task) labels = {label: LabelSummary(label, tasks) for label, tasks in labels.items()} return labels
def label_summaries(self) -> Dict[str, LabelSummary]: """All label summaries combining retriggers. Returns: dict: A dictionary of the form {<label>: [<LabelSummary>]}. """ labels = defaultdict(list) for task in self.tasks: # We can't consider tasks that were chunked in the taskgraph for finding label-level regressions # because tasks with the same name on different pushes might contain totally different tests. if task.tags.get("tests_grouped") == "1": continue labels[task.label].append(task) return { label: LabelSummary(label, tasks) for label, tasks in labels.items() }
def label_summaries(self) -> Dict[str, LabelSummary]: """All label summaries combining retriggers. Returns: dict: A dictionary of the form {<label>: [<LabelSummary>]}. """ # We can't consider tasks from manifest-level pushes for finding label-level regressions # because tasks with the same name on different pushes might contain totally different tests. if self.is_manifest_level: return {} labels = defaultdict(list) for task in self.tasks: labels[task.label].append(task) return { label: LabelSummary(label, tasks) for label, tasks in labels.items() }
def __make_label_summary_objects(pushes): """Generates a list of LabelSummary objects from a list of pushes. Args: pushes (list): List of Push objects. Returns: list: List of LabelSummary objects. """ # Flatten list of tasks for every push to a 1-dimensional list. tasks = sorted([task for push in pushes for task in push.tasks], key=lambda x: x.label) mapping = defaultdict(lambda: defaultdict(list)) # Make a mapping keyed by task.label containing list of Task objects. for task in tasks: mapping[task.label]["tasks"].append(task) return [ LabelSummary(key, value["tasks"]) for key, value in mapping.items() ]
def __make_label_summary_objects(pushes, branch): """Generates a list of LabelSummary objects from a list of pushes. Args: pushes (list): List of Push objects. Returns: list: List of LabelSummary objects. """ # Flatten list of tasks for every push to a 1-dimensional list. tasks = sorted([task for push in pushes for task in push.tasks], key=lambda x: x.label) # Make a mapping keyed by task.label containing list of Task objects. tasks_by_config = defaultdict(lambda: defaultdict(list)) for task in tasks: tasks_by_config[task.configuration][task.label]["tasks"].append(task) return [ LabelSummary(label, tasks) for config in tasks_by_config.keys() for label, tasks in tasks_by_config[config].items() ]