Skip to content

Commit

Permalink
Fix a bug with over collapsing paths
Browse files Browse the repository at this point in the history
This is issue:
#169
  • Loading branch information
begoldsm committed Jul 10, 2017
1 parent 623b901 commit d924383
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dist/
tests/__pycache__/
*.suo
publish/
adlsenv/
adlsenv*/
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.0.14 (2017-07-10)
-------------------
* Fix an issue where common prefixes in paths for upload and download were collapsed into only unique paths.

0.0.13 (2017-06-28)
-------------------
* Add support for automatic refreshing of service principal credentials
Expand Down
2 changes: 1 addition & 1 deletion azure/datalake/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# license information.
# --------------------------------------------------------------------------

__version__ = "0.0.13"
__version__ = "0.0.14"

from .core import AzureDLFileSystem
from .multithread import ADLDownloader
Expand Down
10 changes: 5 additions & 5 deletions azure/datalake/store/multithread.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .core import AzureDLPath, _fetch_range
from .exceptions import FileExistsError
from .transfer import ADLTransferClient
from .utils import commonprefix, datadir, read_block, tokenize
from .utils import datadir, read_block, tokenize

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -190,8 +190,8 @@ def _setup(self):
else:
rfiles = self.client._adlfs.glob(self.rpath, details=True, invalidate_cache=True)
if len(rfiles) > 1:
prefix = commonprefix([f['name'] for f in rfiles])
file_pairs = [(os.path.join(self.lpath, os.path.relpath(f['name'] +'.inprogress', prefix)), f)
local_rel_rpath = str(AzureDLPath(self.rpath).globless_prefix)
file_pairs = [(os.path.join(self.lpath, os.path.relpath(f['name'] +'.inprogress', local_rel_rpath)), f)
for f in rfiles]
elif len(rfiles) == 1:
if os.path.exists(self.lpath) and os.path.isdir(self.lpath):
Expand Down Expand Up @@ -442,8 +442,8 @@ def _setup(self):
lfiles = glob.glob(self.lpath)

if len(lfiles) > 1:
prefix = commonprefix(lfiles)
file_pairs = [(f, self.rpath / AzureDLPath(f).relative_to(prefix)) for f in lfiles]
local_rel_lpath = str(AzureDLPath(self.lpath).globless_prefix)
file_pairs = [(f, self.rpath / AzureDLPath(f).relative_to(local_rel_lpath)) for f in lfiles]
elif lfiles:
if self.client._adlfs.exists(self.rpath, invalidate_cache=True) and \
self.client._adlfs.info(self.rpath, invalidate_cache=False)['type'] == "DIRECTORY":
Expand Down

0 comments on commit d924383

Please sign in to comment.