def resolvepath(self, hdfs_path):
"""Return absolute, normalized path.
:param hdfs_path: Remote path.
"""
path = hdfs_path
if not psp.isabs(path):
if not self.root or not psp.isabs(self.root):
root = self._api_request(method='GET', hdfs_path='/', params={'op': 'GETHOMEDIRECTORY'}).json()['Path']
self.root = psp.join(root, self.root) if self.root else root
_logger.debug('Updated root to %r.', self.root)
path = psp.join(self.root, path)
path = psp.normpath(path)
_logger.debug('Resolved path %r to %r.', hdfs_path, path)
return path
评论列表
文章目录