def run_conv_file_hdfs(conf: ConfigData, the_date: str, is_baoli=True):
    the_date = StrTool.get_the_date_str(the_date)
    client = Client(conf.hdfs_ip())  # "http://10.2.201.197:50070"
    root_path = conf.get_data_path()  # 'D:/DATA/UNZIP/'
    dest_dir = conf.get_hdfs_path()

    f_name = conf.get_file_name(
        the_date)  # "t1_trxrecord_" the_date # "_V2.csv"

    print("Start\n")

    branches = MyLocalFile.get_child(os.path.join(root_path, the_date))
    for aBranch in branches:
        if MyLocalFile.check_branch(aBranch):
            files = MyLocalFile.get_child(aBranch)
            for aFile in files:
                if MyLocalFile.check_file(aFile, f_name):
                    MyHdfsFile.conv_file_hdfs(
                        aFile,
                        os.path.join(dest_dir, the_date,
                                     os.path.basename(aBranch), f_name),
                        client)
Exemple #2
0
def run_conv_file_hdfs(configData: ConfigData):
    f_date_str = configData.get_f_date()  # "20181101"

    client = InsecureClient(configData.hdfs_ip(), user="******")  # "http://10.2.201.197:50070"
    root_path = configData.get_data_path()  # 'D:/DATA/UNZIP/'
    dest_dir = configData.get_hdfs_path()

    f_name = configData.get_file_name(f_date_str)  # "t1_trxrecord_" the_date # "_V2.csv"

    print("Start\n")

    branches = MyLocalFile.get_child(os.path.join(root_path, f_date_str))
    for aBranch in branches:
        if MyLocalFile.check_branch(aBranch):
            files = MyLocalFile.get_child(aBranch)
            for aFile in files:
                if MyLocalFile.check_file(aFile, f_name):
                    MyHdfsFile.conv_file_hdfs(aFile,
                                              os.path.join(dest_dir,
                                                           f_date_str,
                                                           os.path.basename(aBranch),
                                                           f_name),
                                              client)