mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
stage: hide unwanted warnings (#3763)
These messages all correpond to expected behaviour, so there is no need to polute the output with unnecessary warnings.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import logging
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
from functools import wraps
|
||||
@@ -435,8 +434,7 @@ class Repo(object):
|
||||
for file_name in filter(is_valid_filename, files):
|
||||
path = os.path.join(root, file_name)
|
||||
stage_loader = Dvcfile(self, path).stages
|
||||
with stage_loader.log_level(at=logging.DEBUG):
|
||||
stages.extend(stage_loader.values())
|
||||
stages.extend(stage_loader.values())
|
||||
outs.update(
|
||||
out.fspath
|
||||
for stage in stages
|
||||
|
||||
@@ -246,13 +246,13 @@ class Stage(params.StageParams):
|
||||
def stage_changed(self, warn=False):
|
||||
changed = self.md5 != self._compute_md5()
|
||||
if changed and warn:
|
||||
logger.warning("DVC-file '{}' changed.".format(self.relpath))
|
||||
logger.debug("DVC-file '{}' changed.".format(self.relpath))
|
||||
return changed
|
||||
|
||||
@rwlocked(read=["deps", "outs"])
|
||||
def changed(self):
|
||||
if self._changed():
|
||||
logger.warning("{} changed.".format(self))
|
||||
logger.debug("{} changed.".format(self))
|
||||
return True
|
||||
|
||||
logger.debug("{} didn't change.".format(self))
|
||||
@@ -831,5 +831,5 @@ class PipelineStage(Stage):
|
||||
|
||||
def stage_changed(self, warn=False):
|
||||
if self.cmd_changed and warn:
|
||||
logger.warning("'cmd' of {} has changed.".format(self))
|
||||
logger.debug("'cmd' of {} has changed.".format(self))
|
||||
return self.cmd_changed
|
||||
|
||||
+2
-19
@@ -1,7 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
from collections import Mapping, defaultdict
|
||||
from contextlib import contextmanager
|
||||
from copy import deepcopy
|
||||
from itertools import chain
|
||||
|
||||
@@ -30,14 +29,6 @@ class StageLoader(Mapping):
|
||||
self.dvcfile = dvcfile
|
||||
self.stages_data = stages_data or {}
|
||||
self.lockfile_data = lockfile_data or {}
|
||||
self._log_level = logging.WARNING
|
||||
|
||||
@contextmanager
|
||||
def log_level(self, at):
|
||||
"""Change log_level temporarily for StageLoader."""
|
||||
self._log_level, level = at, self._log_level
|
||||
yield
|
||||
self._log_level = level
|
||||
|
||||
def filter(self, item=None):
|
||||
if not item:
|
||||
@@ -154,11 +145,8 @@ class StageLoader(Mapping):
|
||||
raise StageNotFound(self.dvcfile, name)
|
||||
|
||||
if not self.lockfile_data.get(name):
|
||||
logger.log(
|
||||
self._log_level,
|
||||
"No lock entry found for '%s:%s'",
|
||||
self.dvcfile.relpath,
|
||||
name,
|
||||
logger.debug(
|
||||
"No lock entry found for '%s:%s'", self.dvcfile.relpath, name,
|
||||
)
|
||||
|
||||
return self.load_stage(
|
||||
@@ -187,11 +175,6 @@ class SingleStageLoader(Mapping):
|
||||
def filter(self, item=None):
|
||||
return self
|
||||
|
||||
@contextmanager
|
||||
def log_level(self, *args, **kwargs):
|
||||
"""No-op context manager."""
|
||||
yield
|
||||
|
||||
def __getitem__(self, item):
|
||||
if item:
|
||||
logger.warning(
|
||||
|
||||
Reference in New Issue
Block a user