使用dispy将工作分配给ec2实例

时间:2016-02-03 18:42:22

标签: python amazon-web-services amazon-ec2 dispy

我试图使用dispy将工作分发给ec2实例。

我跟着:

Using dispy with port forwarding via ssh tunnel

http://dispy.sourceforge.net/dispy.html#cloud

但它不会去任何地方,客户端脚本挂起,服务器节点也没有收到任何内容。

我现在拥有的是:

来自我的机器:

ssh -i mypemfile.pem -R 51347:localhost:51347 ubuntu@ec2-52-30-185-175.eu-west-1.compute.amazonaws.com

然后在远程机器上:

sudo dispynode.py --ext_ip_addr ec2-52-30-185-175.eu-west-1.compute.amazonaws.com -d

我得到:

2016-02-03 18:38:39,410 - dispynode - dispynode version 4.6.7
2016-02-03 18:38:39,414 - asyncoro - poller: epoll
2016-02-03 18:38:39,417 - dispynode - serving 1 cpus at 172.31.26.18:51348
2016-02-03 18:38:39,417 - dispynode - tcp server at 172.31.26.18:51348
2016-02-03 18:38:39,422 - asyncoro - waiting for 2 coroutines to terminate
Enter "quit" or "exit" to terminate dispynode,
  "stop" to stop service, "start" to restart service,
  "cpus" to change CPUs used, anything else to get status:

在我运行的客户端计算机上:

import dispy
def f(x):
    return 2*x
cluster = dispy.JobCluster(f,nodes=['ec2-52-30-185-175.eu-west-1.compute.amazonaws.com'],ext_ip_addr='localhost')
job = cluster.submit(2)
print('result: %s' % job())

没有任何反应,只是卡住了。 感谢

0 个答案:

没有答案