Skip to content
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
14 changes: 11 additions & 3 deletions dvc/stage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,21 @@ def compute_md5(self):
logger.debug("Computed %s md5: '%s'", self, m)
return m

def save(self, allow_missing: bool = False, merge_versioned: bool = False):
def save(
self,
allow_missing: bool = False,
merge_versioned: bool = False,
run_cache: bool = True,
):
self.save_deps(allow_missing=allow_missing)

self.save_outs(
allow_missing=allow_missing, merge_versioned=merge_versioned
)
self.md5 = self.compute_md5()

self.repo.stage_cache.save(self)
if run_cache:
self.repo.stage_cache.save(self)

def save_deps(self, allow_missing=False):
from dvc.dependency.base import DependencyDoesNotExistError
Expand Down Expand Up @@ -584,7 +590,9 @@ def run(
if not dry:
if kwargs.get("checkpoint_func", None) or no_download:
allow_missing = True
self.save(allow_missing=allow_missing)

self.save(allow_missing=allow_missing, run_cache=not no_commit)

if no_download:
self.ignore_outs()
if not no_commit:
Expand Down
2 changes: 1 addition & 1 deletion tests/func/test_data_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def test_push_pull_all(tmp_dir, scm, dvc, local_remote, key, expected):

def test_push_pull_fetch_pipeline_stages(tmp_dir, dvc, run_copy, local_remote):
tmp_dir.dvc_gen("foo", "foo")
run_copy("foo", "bar", no_commit=True, name="copy-foo-bar")
run_copy("foo", "bar", name="copy-foo-bar")

dvc.push("copy-foo-bar")
assert len(recurse_list_dir(local_remote.url)) == 1
Expand Down
3 changes: 2 additions & 1 deletion tests/func/test_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,8 @@ def test_repro_no_commit(tmp_dir, dvc, copy_script, run_stage):
remove(dvc.odb.local.path)
ret = main(["repro", stage.addressing, "--no-commit"])
assert ret == 0
assert os.listdir(dvc.odb.local.path) == ["runs"]
# run-cache should be skipped if `-no-commit`.
assert not os.path.isdir(dvc.odb.local.path)


class TestReproAlreadyCached:
Expand Down