From d63db35100a26a51913063481e82d25abce9f87d Mon Sep 17 00:00:00 2001 From: prihoda Date: Thu, 28 Feb 2019 11:16:40 +0100 Subject: [PATCH] Log computed stage MD5 in verbose mode Sometimes it is handy to manually update the stage MD5 checksum after some non-breaking changes were made (e.g. renaming an output file). Logging the computed md5 hash in verbose mode can help experienced users to fix this problem. --- dvc/stage.py | 6 +++--- tests/unit/stage.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dvc/stage.py b/dvc/stage.py index 89cf7e850..152fd89b5 100644 --- a/dvc/stage.py +++ b/dvc/stage.py @@ -556,9 +556,9 @@ class Stage(object): # NOTE: excluding parameters that don't affect the state of the # pipeline. Not excluding `OutputLOCAL.PARAM_CACHE`, because if # it has changed, we might not have that output in our cache. - return dict_md5( - d, exclude=[self.PARAM_LOCKED, OutputLOCAL.PARAM_METRIC] - ) + m = dict_md5(d, exclude=[self.PARAM_LOCKED, OutputLOCAL.PARAM_METRIC]) + logger.debug("Computed stage '{}' md5: '{}'".format(self.relpath, m)) + return m def save(self): for dep in self.deps: diff --git a/tests/unit/stage.py b/tests/unit/stage.py index c92f82940..add84d171 100644 --- a/tests/unit/stage.py +++ b/tests/unit/stage.py @@ -5,7 +5,7 @@ from dvc.stage import Stage class TestStageChecksum(TestCase): def test(self): - stage = Stage(None) + stage = Stage(None, "path") outs = [{"path": "a", "md5": "123456789"}] deps = [{"path": "b", "md5": "987654321"}] d = {"md5": "123456", "cmd": "mycmd", "outs": outs, "deps": deps}