【发布时间】:2014-06-25 15:55:09
【问题描述】:
所以我写了一些基本结构如下的代码:
from numpy import *
from dataloader import loadfile
from IPython.parallel import Client
from clustering import *
data = loadfile(0)
N_CLASSES = 10
rowmax = nanmax(data.values, 0)
rowmin = nanmin(data.values, 0)
# Defines the size of block processed at a time
BLOCK_SIZE = 50000
classmean, classcov, classcovinv, classlogdet, classlogprob = init_stats(data, N_CLASSES, rowmax, rowmin)
client = Client()
ids = client.ids
nodes = len(ids)
view = client.load_balanced_view()
dview = client[:]
def get_ml_class(data, args): do sth
dview.scatter('datablock', data)
dview.execute('res1, res2 = get_ml_class(datablock, args)', block=False)
dview.execute 部分的输出是
<AsyncResult: execute>
这意味着它被执行了,但是,当我试图拉结果时
dview.pull(['res1','res2'], block=True)
它显示:
NameError: name 'res1' is not defined
谁能告诉我我的代码有什么问题?非常感谢!
【问题讨论】:
标签: python parallel-processing ipython ipython-parallel