mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
output: use remote kwarg instead of odb (#6600)
* output: use remote kwarg instead of odb Fixes #6596 * Update dvc/output.py Co-authored-by: Dave Berenbaum <[email protected]> * add test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Dave Berenbaum <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Dave Berenbaum
pre-commit-ci[bot]
parent
237e9d4354
commit
dae08255d0
+3
-2
@@ -849,8 +849,9 @@ class Output:
|
||||
try:
|
||||
objects.check(self.odb, obj)
|
||||
except FileNotFoundError:
|
||||
remote = self.repo.cloud.get_remote_odb(self.remote)
|
||||
self.repo.cloud.pull([obj.hash_info], odb=remote, **kwargs)
|
||||
if self.remote:
|
||||
kwargs["remote"] = self.remote
|
||||
self.repo.cloud.pull([obj.hash_info], **kwargs)
|
||||
|
||||
if self.obj:
|
||||
return self.obj
|
||||
|
||||
@@ -653,3 +653,35 @@ def test_output_remote(tmp_dir, dvc, make_remote):
|
||||
"6b18131dc289fd37006705affe961ef8.dir",
|
||||
"b8a9f715dbb64fd5c56e7783c6820a61",
|
||||
}
|
||||
|
||||
|
||||
def test_target_remote(tmp_dir, dvc, make_remote):
|
||||
make_remote("default", default=True)
|
||||
make_remote("myremote", default=False)
|
||||
|
||||
tmp_dir.dvc_gen("foo", "foo")
|
||||
tmp_dir.dvc_gen("data", {"one": "one", "two": "two"})
|
||||
|
||||
dvc.push(remote="myremote")
|
||||
|
||||
default = dvc.cloud.get_remote_odb("default")
|
||||
myremote = dvc.cloud.get_remote_odb("myremote")
|
||||
|
||||
assert set(default.all()) == set()
|
||||
assert set(myremote.all()) == {
|
||||
"acbd18db4cc2f85cedef654fccc4a4d8",
|
||||
"f97c5d29941bfb1b2fdab0874906ab82",
|
||||
"6b18131dc289fd37006705affe961ef8.dir",
|
||||
"b8a9f715dbb64fd5c56e7783c6820a61",
|
||||
}
|
||||
|
||||
clean(["foo", "data"], dvc)
|
||||
|
||||
dvc.pull(remote="myremote")
|
||||
|
||||
assert set(dvc.odb.local.all()) == {
|
||||
"acbd18db4cc2f85cedef654fccc4a4d8",
|
||||
"f97c5d29941bfb1b2fdab0874906ab82",
|
||||
"6b18131dc289fd37006705affe961ef8.dir",
|
||||
"b8a9f715dbb64fd5c56e7783c6820a61",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user