Skip to content

Commit

Permalink
hdfs: implement isdir and isfile
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Aug 24, 2020
1 parent f789cdf commit d10d49c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dvc/tree/hdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ def copy(self, from_info, to_info, **_kwargs):
self.remove(tmp_info)
raise

def isfile(self, path_info):
with self.hdfs(path_info) as hdfs:
return hdfs.isfile(path_info.path)

def isdir(self, path_info):
with self.hdfs(path_info) as hdfs:
return hdfs.isdir(path_info.path)

def hadoop_fs(self, cmd, user=None):
cmd = "hadoop fs -" + cmd
if user:
Expand Down
1 change: 1 addition & 0 deletions tests/func/test_import_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def test_import_url(tmp_dir, dvc, workspace):
pytest.lazy_fixture("local_cloud"),
pytest.lazy_fixture("s3"),
pytest.lazy_fixture("gs"),
pytest.lazy_fixture("hdfs"),
pytest.param(
pytest.lazy_fixture("ssh"),
marks=pytest.mark.skipif(
Expand Down

0 comments on commit d10d49c

Please sign in to comment.