def create(cls, task_entries): """Creates a NodeBuilder with tasks indexed by their output type.""" serializable_tasks = defaultdict(set) for entry in task_entries: if isinstance(entry, (tuple, list)) and len(entry) == 3: output_type, input_selects, task = entry serializable_tasks[output_type].add( TaskNodeFactory(tuple(input_selects), task, output_type) ) elif isinstance(entry, SnapshottedProcess): serializable_tasks[entry.output_product_type].add(entry) else: raise Exception("Unexpected type for entry {}".format(entry)) intrinsics = dict() intrinsics.update(FilesystemNode.as_intrinsics()) intrinsics.update(SnapshotNode.as_intrinsics()) return cls(serializable_tasks, intrinsics)
def as_node(self, subject, variants): assert type(subject) in (Files, PathGlobs) return SnapshotNode.create(subject, variants)