mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 15:28:28 +01:00
tree: Implement upload_fobj protocol to all trees (#5307)
* tree: Implement upload_fobj protocol to azure * tree: Implement upload_fobj protocol to google storage * tree: Implement upload_fobj protocol to google drive * tree: Implement upload_fobj protocol to hdfs * tree: Implement upload_fobj protocol to oss (alibaba cloud) * tree: Implement upload_fobj protocol to webhdfs (also some cleanup) * tree: Implement upload_fobj protocol to http/https * Add _generate_download_url() to the HTTP (for tests) * tree: Implement a temporary upload_fobj protocol to webdav/webdavs * Unify progress bars * Lazily evaluate the file size, for http uploads * Remove copy_fobj protocol and _transfer_file_as_whole * show progress bar on cache transfer * Simplify s3 upload * Remove CHUNK_SIZE (except for some special cases) * remove concurrency restrictions * Update dvc/tree/oss.py Co-authored-by: Ruslan Kuprieiev <[email protected]> Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
co-authored by
Ruslan Kuprieiev
parent
434cd305e9
commit
a5e19ecd6a
@@ -295,3 +295,33 @@ def test_tree_getsize(dvc, cloud):
|
||||
|
||||
assert tree.getsize(path_info / "baz") == 7
|
||||
assert tree.getsize(path_info / "data" / "foo") == 3
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cloud",
|
||||
[
|
||||
pytest.lazy_fixture("azure"),
|
||||
pytest.lazy_fixture("gs"),
|
||||
pytest.lazy_fixture("gdrive"),
|
||||
pytest.lazy_fixture("hdfs"),
|
||||
pytest.lazy_fixture("http"),
|
||||
pytest.lazy_fixture("local_cloud"),
|
||||
pytest.lazy_fixture("oss"),
|
||||
pytest.lazy_fixture("s3"),
|
||||
pytest.lazy_fixture("ssh"),
|
||||
pytest.lazy_fixture("webhdfs"),
|
||||
],
|
||||
)
|
||||
def test_tree_upload_fobj(dvc, tmp_dir, cloud):
|
||||
tmp_dir.gen("foo", "foo")
|
||||
tree = get_cloud_tree(dvc, **cloud.config)
|
||||
|
||||
from_info = tmp_dir / "foo"
|
||||
to_info = tree.path_info / "foo"
|
||||
|
||||
with open(from_info, "rb") as stream:
|
||||
tree.upload_fobj(stream, to_info)
|
||||
|
||||
assert tree.exists(to_info)
|
||||
with tree.open(to_info, "rb") as stream:
|
||||
assert stream.read() == b"foo"
|
||||
|
||||
@@ -42,13 +42,3 @@ def test_get_file_hash(tmp_dir, azure):
|
||||
assert hash_
|
||||
assert isinstance(hash_, str)
|
||||
assert hash_.strip("'").strip('"') == hash_
|
||||
|
||||
|
||||
def test_azure_dir_gen(tmp_dir, azure):
|
||||
azure.gen({"data": {"foo": "foo", "bar": {"baz": "baz"}}})
|
||||
data_info = azure / "data"
|
||||
|
||||
assert (data_info / "foo").read_text() == "foo"
|
||||
|
||||
(data_info / "bar" / "baz").write_text("quux")
|
||||
assert (data_info / "bar" / "baz").read_bytes() == b"quux"
|
||||
|
||||
Reference in New Issue
Block a user