def used_cache( self, targets=None, all_branches=False, with_deps=False, all_tags=False, all_commits=False, remote=None, force=False, jobs=None, recursive=False, ): """Get the stages related to the given target and collect the `info` of its outputs. This is useful to know what files from the cache are _in use_ (namely, a file described as an output on a stage). The scope is, by default, the working directory, but you can use `all_branches` or `all_tags` to expand scope. Returns: A dictionary with Schemes (representing output's location) as keys, and a list with the outputs' `dumpd` as values. """ from funcy.py2 import icat from dvc.cache import NamedCache cache = NamedCache() for branch in self.brancher( all_branches=all_branches, all_tags=all_tags, all_commits=all_commits, ): targets = targets or [None] pairs = icat( self.collect_granular( target, recursive=recursive, with_deps=with_deps ) for target in targets ) suffix = "({})".format(branch) if branch else "" for stage, filter_info in pairs: used_cache = stage.get_used_cache( remote=remote, force=force, jobs=jobs, filter_info=filter_info, ) cache.update(used_cache, suffix=suffix) return cache
def test_name_clashes(): counts = py2.count_by(py2.identity, py2.icat(m.__all__ for m in modules)) clashes = [name for name, c in counts.items() if c > 1] assert not clashes, 'names clash for ' + ', '.join(clashes)
def visit_all(self, *node_lists): for node in icat(node_lists): self.visit(node)