【发布时间】:2014-05-21 05:09:46
【问题描述】:
我正在使用谷歌mapreduce lib 来处理我的数据。在处理数据时,在映射器函数中使用计数器。但我不知道如何在 finalized 方法中获得计数器结果。
def mapper(obj):
yield obj
yield operation.counters.Increment("process-obj")
class Test(base_handler.PipelineBase):
"""A pipeline to ingest log as CSV in Google Storage
"""
def run(self, setting_id):
filepath = yield mapreduce_pipeline.MapperPipeline(
"test",
"mapper",
"mapreduce.input_readers.DatastoreInputReader",
output_writer_spec="mapreduce.output_writers.FileOutputWriter",
params={
},
shards=10
)
def finalized(self):
# how to read the counter process-obj
# how to get the setting_id
pass
【问题讨论】:
标签: python google-app-engine mapreduce