pip3 install hdfs
hdfs_util.py
class HdfsUtils:
def __init__(self, config):
name_node = config.get_prop("hdfs", "name_node")
user = config.get_prop("hdfs", "user")
self.__client = InsecureClient(name_node, user)
def makedirs(self, path, permissions):
self.__client.makedirs(path, permissions)
def rename(self, source_path_name, dest_path_name):
self.__client.rename(source_path_name, dest_path_name)
def delete(self, path_name, recursive=False):
self.__client.delete(path_name, recursive)
def upload(self, hdfs_path, local_path):
self.__client.upload(hdfs_path, local_path)
def download(self, hdfs_path, local_path):
self.__client.download(hdfs_path, local_path)
def save_hdfs():
config = ConfigUtil()
config.set_pr