push: fix http storage ignoring method setting

Add method overriding the default put_file in http.py
where the upload method is passed to the http implementation.

Fixes: #6694
This commit is contained in:
Dimitar Todorov
2021-11-15 17:50:14 +02:00
committed by Ruslan Kuprieiev
parent 4a1985d7cd
commit 0fea622266
+14 -1
View File
@@ -1,11 +1,13 @@
import threading
from typing import Any
from funcy import cached_property, memoize, wrap_with
from dvc import prompt
from dvc.progress import DEFAULT_CALLBACK
from dvc.scheme import Schemes
from .fsspec_wrapper import FSSpecWrapper, NoDirectoriesMixin
from .fsspec_wrapper import AnyFSPath, FSSpecWrapper, NoDirectoriesMixin
@wrap_with(threading.Lock())
@@ -127,3 +129,14 @@ class HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper):
def unstrip_protocol(self, path: str) -> str:
return path
def put_file(
self,
from_file: AnyFSPath,
to_info: AnyFSPath,
callback: Any = DEFAULT_CALLBACK,
**kwargs,
) -> None:
kwargs["method"] = self.upload_method
self.fs.put_file(from_file, to_info, callback=callback, **kwargs)
self.fs.invalidate_cache(self.path.parent(to_info))