Dvc: Run cache is used even though always-changed is set

Created on 9 Sep 2020  Â·  3Comments  Â·  Source: iterative/dvc

Bug Report

If a stage is marked as always_changed: true, I would argue that it should not use the run cache during dvc repro. For example, here is a dvc.yaml:

stages:
  foo:
    cmd: cat hello.txt > goodbye.txt
    deps:
    - hello.txt
    always_changed: true
    outs:
    - goodbye.txt

When I run

➜ dvc repro
Restored stage 'foo' from run-cache
Skipping run, checking out outputs

I would expect it not to use the run cache because the stage is marked as always changed.

Please provide information about your setup

Output of dvc version:

$ dvc version
1.6.6

Additional Information (if any):

If applicable, please also provide a --verbose output of the command, eg: dvc add --verbose.

➜ dvc repro --verbose
2020-09-09 12:14:19,170 DEBUG: Check for update is enabled.
2020-09-09 12:14:19,173 DEBUG: assuming default target 'dvc.yaml'.
2020-09-09 12:14:19,175 DEBUG: fetched: [(3,)]
2020-09-09 12:14:19,336 DEBUG: stage: 'foo' changed.
2020-09-09 12:14:19,338 DEBUG: Removing output 'goodbye.txt' of stage: 'foo'.
2020-09-09 12:14:19,339 DEBUG: Removing '/Users/pokey/src/dvc-experiment/goodbye.txt'
2020-09-09 12:14:19,340 DEBUG: Path '/Users/pokey/src/dvc-experiment/hello.txt' inode '77106974'
2020-09-09 12:14:19,340 DEBUG: fetched: [('1599647023428806400', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599649987456615936')]
2020-09-09 12:14:19,340 DEBUG: Path '/Users/pokey/src/dvc-experiment/hello.txt' inode '77106974'
2020-09-09 12:14:19,340 DEBUG: fetched: [('1599647023428806400', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599650059340388096')]
2020-09-09 12:14:19,342 DEBUG: Path '/Users/pokey/src/dvc-experiment/hello.txt' inode '77106974'
2020-09-09 12:14:19,342 DEBUG: fetched: [('1599647023428806400', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599650059340883968')]
2020-09-09 12:14:19,345 DEBUG: Assuming '/Users/pokey/src/dvc-experiment/.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e' is unchanged since it is read-only
Restored stage 'foo' from run-cache
Skipping run, checking out outputs
2020-09-09 12:14:19,346 DEBUG: checking if 'goodbye.txt'('{'md5': '764efa883dda1e11db47671c4a3bbd9e'}') has changed.
2020-09-09 12:14:19,347 DEBUG: 'goodbye.txt' doesn't exist.
2020-09-09 12:14:19,347 DEBUG: Assuming '/Users/pokey/src/dvc-experiment/.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e' is unchanged since it is read-only
2020-09-09 12:14:19,347 DEBUG: Checking out 'goodbye.txt' with cache '764efa883dda1e11db47671c4a3bbd9e'.
2020-09-09 12:14:19,348 DEBUG: Created 'reflink': .dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e -> goodbye.txt
2020-09-09 12:14:19,348 DEBUG: Path 'goodbye.txt' inode '77111997'
2020-09-09 12:14:19,349 DEBUG: Path 'goodbye.txt' inode '77111997'
2020-09-09 12:14:19,349 DEBUG: fetched: []
2020-09-09 12:14:19,350 DEBUG: Path '/Users/pokey/src/dvc-experiment/hello.txt' inode '77106974'
2020-09-09 12:14:19,350 DEBUG: fetched: [('1599647023428806400', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599650059342238976')]
2020-09-09 12:14:19,372 DEBUG: Assuming '/Users/pokey/src/dvc-experiment/.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e' is unchanged since it is read-only
2020-09-09 12:14:19,373 DEBUG: Path '/Users/pokey/src/dvc-experiment/goodbye.txt' inode '77111997'
2020-09-09 12:14:19,374 DEBUG: fetched: [('1599647040389793536', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599650059349637888')]
2020-09-09 12:14:19,374 DEBUG: {}
2020-09-09 12:14:19,374 DEBUG: Output 'goodbye.txt' didn't change. Skipping saving.
2020-09-09 12:14:19,375 DEBUG: Computed stage: 'foo' md5: '0f7c3a4ec9609b4d4669ca2facab82e3'
2020-09-09 12:14:19,375 DEBUG: Path '/Users/pokey/src/dvc-experiment/hello.txt' inode '77106974'
2020-09-09 12:14:19,375 DEBUG: fetched: [('1599647023428806400', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599650059350856960')]
2020-09-09 12:14:19,380 DEBUG: Saving 'goodbye.txt' to '.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e'.
2020-09-09 12:14:19,380 DEBUG: Assuming '/Users/pokey/src/dvc-experiment/.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e' is unchanged since it is read-only
2020-09-09 12:14:19,380 DEBUG: Removing '/Users/pokey/src/dvc-experiment/goodbye.txt'
2020-09-09 12:14:19,381 DEBUG: Created 'reflink': .dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e -> goodbye.txt
2020-09-09 12:14:19,382 DEBUG: Path 'goodbye.txt' inode '77111998'
2020-09-09 12:14:19,382 DEBUG: Path 'goodbye.txt' inode '77111998'
2020-09-09 12:14:19,382 DEBUG: fetched: []
2020-09-09 12:14:19,382 DEBUG: Path '.dvc/cache/76/4efa883dda1e11db47671c4a3bbd9e' inode '77109019'
2020-09-09 12:14:19,382 DEBUG: fetched: [('1599647040389793536', '3', '764efa883dda1e11db47671c4a3bbd9e', '1599649987463953920')]
2020-09-09 12:14:19,384 DEBUG: stage: 'foo' was reproduced
2020-09-09 12:14:19,390 DEBUG: fetched: [(9,)]
2020-09-09 12:14:19,393 DEBUG: Analytics is enabled.
2020-09-09 12:14:19,479 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/var/folders/yb/k48gsy1s3qg1gdd72v9y6rdr0000gn/T/tmpnt4xmi00']'
2020-09-09 12:14:19,481 DEBUG: Spawned '['daemon', '-q', 'analytics', '/var/folders/yb/k48gsy1s3qg1gdd72v9y6rdr0000gn/T/tmpnt4xmi00']'
bug p0-critical

Most helpful comment

Fixed by https://github.com/iterative/dvc/pull/4538 . 1.8.2 and newer are not affected by this bug. @pokey Please give it a try :slightly_smiling_face: Thank you so much for the feedback! :pray:

All 3 comments

Fixed by https://github.com/iterative/dvc/pull/4538 . 1.8.2 and newer are not affected by this bug. @pokey Please give it a try :slightly_smiling_face: Thank you so much for the feedback! :pray:

awesome thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prihoda picture prihoda  Â·  3Comments

robguinness picture robguinness  Â·  3Comments

jorgeorpinel picture jorgeorpinel  Â·  3Comments

shcheklein picture shcheklein  Â·  3Comments

dnabanita7 picture dnabanita7  Â·  3Comments