parallel_write.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:alluxio-py 作者: Alluxio 项目源码 文件源码
def write(client, data, dst, write_type, timer):
    """Write the {src} file in the local filesystem to the {dst} file in Alluxio.

    Args:
        client (:class:`alluxio.Client`): Alluxio client.
        data (str): The file content of the source.
        dst (str): The file to be written to Alluxio.
        write_type (:class:`alluxio.wire.WriteType`): Write type for creating the file.
        timer (:class:`multiprocessing.Value`): Timer for summing up the total time for writing the files.

    Returns:
        float: writing time
    """

    start_time = time.time()
    with client.open(dst, 'w', recursive=True, write_type=write_type) as alluxio_file:
        alluxio_file.write(data)
    elapsed_time = time.time() - start_time
    with timer.get_lock():
        timer.value += elapsed_time
    return elapsed_time
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号