首页 > 编程语言 > 详细

python dask 搭建分布式集群

时间:2020-10-15 16:06:01      阅读:197      评论:0      收藏:0      [点我收藏+]

1、分布式版本安装步骤

1.conda安装:conda install dask distributed-cconda-forge

2.pip 安装:pip install dask distributed --upgrade

3.source安装:

git clone https://github.com/dask/distributed.git

cd distributed 

python  setup.py install

2、主节点启动方法

dask-scheduler

  

控制台显示信息如下:

distributed.scheduler - INFO - -----------------------------------------------

distributed.scheduler - INFO - Clear task state

distributed.scheduler - INFO -  Scheduler at:  tcp://192.168.1.42:8786

distributed.scheduler - INFO -                                                      :8787

distributed.scheduler - INFO - Local Directory: C:\Users\User\AppData\Local\Temp\scheduler-gd9uk980

distributed.scheduler - INFO - -----------------------------------------------

  

3、工作节点启动方法

dask-worker 192.168.1.42:8786

  

工作节点启动成功后,此时主节点会显示多出信息:

distributed.scheduler - INFO - Register tcp://192.168.1.184:45772

distributed.scheduler - INFO - Starting worker compute stream, tcp://192.168.1.184:45772

distributed.core - INFO - Starting established connection

distributed.scheduler - INFO - Register tcp://192.168.1.183:43405

distributed.scheduler - INFO - Starting worker compute stream, tcp://192.168.1.183:43405

distributed.core - INFO - Starting established connection

distributed.scheduler - INFO - Register tcp://192.168.1.188:38095

distributed.scheduler - INFO - Starting worker compute stream, tcp://192.168.1.188:38095

distributed.core - INFO - Starting established connection

  

4、官方测试代码

"""分布式dask"""

import time

from dask.distributed import Client

client = Client(‘192.168.1.42:8786‘ ,asynchronous=True)

ts = time.time()

A = client.map(square, range(10000))

B = client.map(neg, A)

total = client.submit(sum, B)

print(total.result())

print(‘cost time :%s‘%(time.time()-ts))

cost time :3.793848991394043

  

python dask 搭建分布式集群

原文:https://www.cnblogs.com/wuzaipei/p/13820643.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!