Exemplo n.º 1
0
def query_data_block_meta():
    data_block_metas = data_process.query_data_block_meta(**request.json)
    if not data_block_metas:
        return response_api(retcode=500, retmsg='find data block meta failed')
    return response_api(retcode=0,
                        retmsg='success',
                        data=[meta.to_json() for meta in data_block_metas])
Exemplo n.º 2
0
def query_data_source():
    data_sources = data_process.query_data_source(**request.json)
    if not data_sources:
        return response_api(retcode=500, retmsg='find data source failed')
    return response_api(
        retcode=0,
        retmsg='success',
        data=[data_source.to_json() for data_source in data_sources])
def parse_data_block_meta():
    data_block_meta_hdfs_dir = request.json
    dfs_data_block_dir = data_block_meta_hdfs_dir.get('dfs_data_block_dir', '')
    dfs_data_block_meta = data_block_meta_hdfs_dir.get('dfs_data_block_meta',
                                                       '')
    dfs_data_block = data_block_meta_hdfs_dir.get('dfs_data_block', '')
    if not dfs_data_block_dir and not dfs_data_block_meta and not dfs_data_block:
        return response_api(retcode=500, retmsg='args is null')
    parse_data_block_meta_pid = run_subprocess([
        'python', sys.modules[StartParseDataBlockMeta.__module__].__file__,
        '-d', dfs_data_block_dir, '-mt', dfs_data_block_meta, '-db',
        dfs_data_block
    ])
    return response_api(retcode=0, retmsg='success')
Exemplo n.º 4
0
def create_data_block_meta(block_id, partition_id, file_version):
    DataController.update_data_block_meta_status(
        block_id=block_id,
        partition_id=partition_id,
        file_version=int(file_version),
        data_block_meta_info=request.json,
        create=True)
    return response_api(retcode=0, retmsg='success')
def internal_server_error(e):
    logging.error(e)
    return response_api(retcode=100, retmsg=str(e))