【发布时间】:2011-09-09 15:09:52
【问题描述】:
我正在尝试 (http://code.google.com/p/appengine-mapreduce/) 的 mapreduce 框架,并稍微修改了演示应用程序(使用 mapreduce.input_readers.DatastoreInputReader 而不是 mapreduce.input_readers.BlobstoreZipInputReader)。
我设置了 2 个管道类:
class IndexPipeline(base_handler.PipelineBase):
def run(self):
output = yield mapreduce_pipeline.MapreducePipeline(
"index",
"main.index_map", #added higher up in code
"main.index_reduce", #added higher up in code
"mapreduce.input_readers.DatastoreInputReader",
mapper_params={
"entity_kind": "model.SearchRecords",
},
shards=16)
yield StoreOutput("Index", output)
class StoreOutput(base_handler.PipelineBase):
def run(self, mr_type, encoded_key):
logging.info("output is %s %s" % (mr_type, str(encoded_key)))
if encoded_key:
key = db.Key(encoded=encoded_key)
m = db.get(key)
yield op.db.Put(m)
然后运行它:
pipeline = IndexPipeline()
pipeline.start()
但我不断收到此错误:
Handler yielded two: ['a'] , but no output writer is set.
我试图在source 中的某个位置设置输出编写器,但没有成功。我发现的唯一一件事是应该在某处设置output_writer_class。
有人知道怎么设置吗?
附带说明,StoreOutput 中的 encoded_key 参数似乎始终为 None。
【问题讨论】:
标签: google-app-engine mapreduce