Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag: getting rid of it #3699

Merged
merged 4 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dvc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
repro,
root,
run,
tag,
unprotect,
update,
version,
Expand Down Expand Up @@ -71,7 +70,6 @@
pipeline,
daemon,
commit,
tag,
diff,
version,
update,
Expand Down
8 changes: 4 additions & 4 deletions dvc/command/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def _show(self, target, commands, outs, locked):
from dvc import dvcfile
from dvc.utils import parse_target

path, name, tag = parse_target(target)
stage = dvcfile.Dvcfile(self.repo, path, tag=tag).stages[name]
path, name = parse_target(target)
stage = dvcfile.Dvcfile(self.repo, path).stages[name]
G = self.repo.graph
stages = networkx.dfs_postorder_nodes(G, stage)
if locked:
Expand All @@ -38,8 +38,8 @@ def _build_graph(self, target, commands=False, outs=False):
from dvc.repo.graph import get_pipeline
from dvc.utils import parse_target

path, name, tag = parse_target(target)
target_stage = dvcfile.Dvcfile(self.repo, path, tag=tag).stages[name]
path, name = parse_target(target)
target_stage = dvcfile.Dvcfile(self.repo, path).stages[name]
G = get_pipeline(self.repo.pipelines, target_stage)

nodes = set()
Expand Down
156 changes: 0 additions & 156 deletions dvc/command/tag.py

This file was deleted.

7 changes: 3 additions & 4 deletions dvc/dvcfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,18 @@ def dump(self, stage, **kwargs):
class SingleStageFile(FileMixin):
from dvc.schema import COMPILED_SINGLE_STAGE_SCHEMA as SCHEMA

def __init__(self, repo, path, tag=None):
def __init__(self, repo, path):
super().__init__(repo, path)
self.tag = tag

@property
def stage(self):
data, raw = self._load()
return SingleStageLoader.load_stage(self, data, raw, tag=self.tag)
return SingleStageLoader.load_stage(self, data, raw)

@property
def stages(self):
data, raw = self._load()
return SingleStageLoader(self, data, raw, tag=self.tag)
return SingleStageLoader(self, data, raw)

def dump(self, stage, **kwargs):
"""Dumps given stage appropriately in the dvcfile."""
Expand Down
17 changes: 2 additions & 15 deletions dvc/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@
HDFSRemote.PARAM_CHECKSUM: CHECKSUM_SCHEMA,
}

TAGS_SCHEMA = {str: CHECKSUMS_SCHEMA}

SCHEMA = CHECKSUMS_SCHEMA.copy()
SCHEMA[Required(BaseOutput.PARAM_PATH)] = str
SCHEMA[BaseOutput.PARAM_CACHE] = bool
SCHEMA[BaseOutput.PARAM_METRIC] = BaseOutput.METRIC_SCHEMA
SCHEMA[BaseOutput.PARAM_TAGS] = TAGS_SCHEMA
SCHEMA[BaseOutput.PARAM_PERSIST] = bool


def _get(stage, p, info, cache, metric, persist=False, tags=None):
def _get(stage, p, info, cache, metric, persist=False):
parsed = urlparse(p)

if parsed.scheme == "remote":
Expand All @@ -72,7 +69,6 @@ def _get(stage, p, info, cache, metric, persist=False, tags=None):
remote=remote,
metric=metric,
persist=persist,
tags=tags,
)

for o in OUTS:
Expand All @@ -85,7 +81,6 @@ def _get(stage, p, info, cache, metric, persist=False, tags=None):
remote=None,
metric=metric,
persist=persist,
tags=tags,
)
return LocalOutput(
stage,
Expand All @@ -95,7 +90,6 @@ def _get(stage, p, info, cache, metric, persist=False, tags=None):
remote=None,
metric=metric,
persist=persist,
tags=tags,
)


Expand All @@ -106,16 +100,9 @@ def loadd_from(stage, d_list):
cache = d.pop(BaseOutput.PARAM_CACHE, True)
metric = d.pop(BaseOutput.PARAM_METRIC, False)
persist = d.pop(BaseOutput.PARAM_PERSIST, False)
tags = d.pop(BaseOutput.PARAM_TAGS, None)
ret.append(
_get(
stage,
p,
info=d,
cache=cache,
metric=metric,
persist=persist,
tags=tags,
stage, p, info=d, cache=cache, metric=metric, persist=persist,
)
)
return ret
Expand Down
15 changes: 1 addition & 14 deletions dvc/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class BaseOutput(object):
},
)

PARAM_TAGS = "tags"

DoesNotExistError = OutputDoesNotExistError
IsNotFileOrDirError = OutputIsNotFileOrDirError
IsStageFileError = OutputIsStageFileError
Expand All @@ -76,7 +74,6 @@ def __init__(
cache=True,
metric=False,
persist=False,
tags=None,
):
self._validate_output_path(path)
# This output (and dependency) objects have too many paths/urls
Expand All @@ -97,7 +94,6 @@ def __init__(
self.use_cache = False if self.IS_DEPENDENCY else cache
self.metric = False if self.IS_DEPENDENCY else metric
self.persist = persist
self.tags = None if self.IS_DEPENDENCY else (tags or {})

self.path_info = self._parse_path(remote, path)
if self.use_cache and self.cache is None:
Expand Down Expand Up @@ -274,9 +270,6 @@ def dumpd(self):
ret[self.PARAM_METRIC] = self.metric
ret[self.PARAM_PERSIST] = self.persist

if self.tags:
ret[self.PARAM_TAGS] = self.tags

return ret

def verify_metric(self):
Expand All @@ -291,7 +284,6 @@ def checkout(
self,
force=False,
progress_callback=None,
tag=None,
relink=False,
filter_info=None,
):
Expand All @@ -302,14 +294,9 @@ def checkout(
)
return None

if tag:
info = self.tags[tag]
else:
info = self.info

return self.cache.checkout(
self.path_info,
info,
self.info,
force=force,
progress_callback=progress_callback,
relink=relink,
Expand Down
15 changes: 8 additions & 7 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os
from contextlib import contextmanager
from functools import wraps
Expand Down Expand Up @@ -70,7 +71,6 @@ def __init__(self, root_dir=None):
from dvc.repo.metrics import Metrics
from dvc.repo.params import Params
from dvc.scm.tree import WorkingTree
from dvc.repo.tag import Tag
from dvc.utils.fs import makedirs

root_dir = self.find_root(root_dir)
Expand Down Expand Up @@ -106,7 +106,6 @@ def __init__(self, root_dir=None):

self.metrics = Metrics(self)
self.params = Params(self)
self.tag = Tag(self)

self._ignore()

Expand Down Expand Up @@ -211,8 +210,8 @@ def collect(self, target, with_deps=False, recursive=False, graph=None):
os.path.abspath(target), graph or self.graph
)

file, name, tag = parse_target(target)
dvcfile = Dvcfile(self, file, tag=tag)
path, name = parse_target(target)
dvcfile = Dvcfile(self, path)
stages = list(dvcfile.stages.filter(name).values())
if not with_deps:
return stages
Expand All @@ -229,10 +228,10 @@ def collect_granular(self, target, *args, **kwargs):
if not target:
return [(stage, None) for stage in self.stages]

file, name, tag = parse_target(target)
file, name = parse_target(target)
if is_valid_filename(file) and not kwargs.get("with_deps"):
# Optimization: do not collect the graph for a specific .dvc target
stages = Dvcfile(self, file, tag=tag).stages.filter(name)
stages = Dvcfile(self, file).stages.filter(name)
return [(stage, None) for stage in stages.values()]

try:
Expand Down Expand Up @@ -433,7 +432,9 @@ def _collect_stages(self):
for root, dirs, files in self.tree.walk(self.root_dir):
for file_name in filter(is_valid_filename, files):
path = os.path.join(root, file_name)
stages.extend(list(Dvcfile(self, path).stages.values()))
stage_loader = Dvcfile(self, path).stages
with stage_loader.log_level(at=logging.DEBUG):
stages.extend(stage_loader.values())
efiop marked this conversation as resolved.
Show resolved Hide resolved
outs.update(
out.fspath
for stage in stages
Expand Down
Loading