Example #1
0
    DL.clear_storage()
    print('downloading', drive_file['name'])
    csv_path = DL.download_file(drive_file)
    csv_name = csv_path.split('/')[-1].split('_complete')[0]

    # Match to existing
    unifier_id = drive_file['parents'][0]
    brand = search_brands(unifier_id)
    brand_name = brand.path.split('/')[-1]
    pending_file_path = [f'./pending/{file}' for file in os.listdir('./pending/') if brand_name in file and csv_name in file][0]
    # pending_file_path = './pending/pfile_unifier.csv'

    brand_io = find_io_folders(brand)[1]
    container_manager = ContainerManager([csv_path, pending_file_path], brand_io.children[0], True)

    finished_file = container_manager.generate_expanded()
    transformer_file = container_manager.generate_minimized()

    analize_last_run(container_manager)

    DL.upload_file(finished_file, unifier_id)
    DL.upload_file(transformer_file, unifier_id)
    os.remove(finished_file)
    os.remove(transformer_file)
    os.remove(pending_file_path)
    slack(f'uploaded {brand.path}/unifier_io/{finished_file.split("/")[-1]}') if SLACK else False


print('Continue to record time')
pdb.set_trace()
print('done')