Dvc: run cache: push/pull is broken

Created on 11 Jun 2020  路  3Comments  路  Source: iterative/dvc

Bug Report

Please provide information about your setup

Setup:

cd $(mktemp -d)
mkdir {remote,repo}
cd repo
dvc init --no-scm
echo "foo" > foo
dvc run -n copy-foo-bar -d foo -o bar "cp foo bar"
dvc remote add -d remote ../remote

Output:

$ dvc push --run-cache -v
2020-06-11 12:50:21,102 DEBUG: fetched: [(3,)]
2020-06-11 12:50:21,103 DEBUG: fetched: [(3,)]
2020-06-11 12:50:21,103 ERROR: unexpected error - 'LocalRemote' object has no attribute 'upload'
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/saugat/repos/iterative/dvc/dvc/main.py", line 53, in main
    ret = cmd.run()
  File "/home/saugat/repos/iterative/dvc/dvc/command/data_sync.py", line 58, in run
    run_cache=self.args.run_cache,
  File "/home/saugat/repos/iterative/dvc/dvc/repo/__init__.py", line 35, in wrapper
    ret = f(repo, *args, **kwargs)
  File "/home/saugat/repos/iterative/dvc/dvc/repo/push.py", line 17, in push
    used_run_cache = self.stage_cache.push(remote) if run_cache else []
  File "/home/saugat/repos/iterative/dvc/dvc/stage/cache.py", line 180, in push
    return self._transfer(remote.upload, self.repo.cache.local, remote)
AttributeError: 'LocalRemote' object has no attribute 'upload'
------------------------------------------------------------

Output of dvc version:

$ dvc version
DVC version: 1.0.0a10+4042d5
Python version: 3.6.6
Platform: Linux-5.5.2-arch1-1-x86_64-with-arch
Binary: False
Package: None
Supported remotes: azure, gdrive, gs, hdfs, http, https, s3, ssh, oss
Cache: reflink - not supported, hardlink - supported, symlink - supported
Filesystem type (cache directory): ('tmpfs', 'tmpfs')
Repo: dvc (no_scm)
Filesystem type (workspace): ('tmpfs', 'tmpfs')

cc @pmrowla

bug p0-critical

Most helpful comment

In stage/cache.py: _transfer, push(), pull() should be updated to reflect that

  • remote.exists
  • remote.walk_files
  • remote.upload
  • remote.download

have all been moved to remote.tree.func()

All 3 comments

Here's a test that I have been writing:

def test_push_pull(tmp_dir, dvc, erepo_dir, run_copy, setup_remote):
    tmp_dir.gen("foo", "foo")
    run_copy("foo", "bar", name="copy-foo-bar")
    url = setup_remote(dvc)
    dvc.push(run_cache=True)  # fails here already
    setup_remote(erepo_dir.dvc, url)
    with erepo_dir.chdir():
        erepo_dir.dvc.pull(run_cache=True)
        assert os.listdir(erepo_dir.dvc.stage_cache.cache_dir)

In stage/cache.py: _transfer, push(), pull() should be updated to reflect that

  • remote.exists
  • remote.walk_files
  • remote.upload
  • remote.download

have all been moved to remote.tree.func()

My bad for not covering that one with proper tests. Was in a rush back then. Should've at least created an issue and should've added it to the next sprint. Lesson learned. :slightly_frowning_face:

Was this page helpful?
0 / 5 - 0 ratings