use fsspec.download for S3 artifacts + additional logging (#2536)

This commit is contained in:
Emanuele Bezzi
2022-07-29 11:05:36 +00:00
committed by GitHub
parent 6c86216f6b
commit d2b20129f7
2 changed files with 8 additions and 5 deletions
+2 -3
View File
@@ -113,10 +113,9 @@ class DataLocator:
# do our best to create a file with the same.
ext = os.path.splitext(self.path)
suffix = None if ext[1] == "" else ext[1]
with self.open() as src, tempfile.NamedTemporaryFile(prefix="cellxgene_", suffix=suffix, delete=False) as tmp:
tmp.write(src.read())
with tempfile.NamedTemporaryFile(prefix="cellxgene_", suffix=suffix, delete=False) as tmp:
self.fs.download(self.uri_or_path, tmp.name)
tmp.close()
src.close()
tmp_path = tmp.name
return LocalFilePath(tmp_path, delete=True)