当前位置: 首页>>代码示例>>Python>>正文


Python Client.map方法代码示例

本文整理汇总了Python中dask.distributed.Client.map方法的典型用法代码示例。如果您正苦于以下问题:Python Client.map方法的具体用法?Python Client.map怎么用?Python Client.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dask.distributed.Client的用法示例。


在下文中一共展示了Client.map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from dask.distributed import Client [as 别名]
# 或者: from dask.distributed.Client import map [as 别名]
def main():
    """."""
    host = os.getenv('DASK_SCHEDULER_HOST', default='localhost')
    port = os.getenv('DASK_SCHEDULER_PORT', default=8786)
    print(host, port)
    client = Client('{}:{}'.format(host, port))
    # client.run(init_logging)
    # client.run_on_scheduler(init_logging)

    # Run some mock functions and gather a result
    data = client.map(print_listdir, range(10))
    future = client.submit(print_values, data)
    progress(future)
    print('')
    result = client.gather(future)
    print(result)

    # Run a second stage which runs some additional processing.
    print('here A')
    data_a = client.map(set_value, range(100))
    print('here B')
    data_b = client.map(square, data_a)
    print('here C')
    data_c = client.map(neg, data_b)
    print('here D')
    # Submit a function application to the scheduler
    total = client.submit(sum, data_c)
    print('here E')
    progress(total)
    print(total.result())
    print('here F')
开发者ID:SKA-ScienceDataProcessor,项目名称:integration-prototype,代码行数:33,代码来源:workflow.py

示例2: main

# 需要导入模块: from dask.distributed import Client [as 别名]
# 或者: from dask.distributed.Client import map [as 别名]
def main():
    client = Client('localhost:8786')
    A = client.map(set_value, range(100))
    B = client.map(square, A)
    C = client.map(neg, B)
    total = client.submit(sum, C)
    print(progress(total))
    print(total.result())
开发者ID:SKA-ScienceDataProcessor,项目名称:integration-prototype,代码行数:10,代码来源:quickstart01.py


注:本文中的dask.distributed.Client.map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。