2013-01-04 29 views
0

我想通過以下步驟執行MapReduce工作:GAE的MapReduce - 從HTML表單輸入使用文件

1)從文件地圖是通過HTML表單輸入

2)減少,並創造新從減少的文件

這是我目前如何有我的管道設置。主要問題是如何將文件傳遞給RecordsReader。

RecordsReader有一個要傳遞的參數文件「要麼是包含要讀取的文件的字符串,要麼是包含要讀取的多個文件串的列表」。 -Google

class EPNPipeline(base_handler.PipelineBase): 
    def run(self, filekey): 
     logging.debug("filename is %s" % filekey) 
     output = yield mapreduce_pipeline.MapreducePipeline(
      "EPN", 
      "map_process_epn", 
      "reduce_process_epn", 
      "mapreduce.input_readers.RecordsReader", 
      "mapreduce.output_writers.BlobstoreOutputWriter", 
      mapper_params={ 
       "files": filekey,     
      }, 
      reducer_params={ 
       "mime_type": "text/plain", 
      }, 
      shards=24) 
     yield StoreOutput("EPN", filekey, output) 

我試圖傳遞文件的文件對象作爲一個字符串表示但既不作品並沒有使用不同的輸入/輸出讀/寫,因爲我想盡可能多的文件。

任何幫助或指針將不勝感激。

感謝

回答

1

的示例應用程序描述in the documentation顯示究竟是如何做到這一點。您需要將文件上傳到blobstore,然後將blob密鑰傳遞給mapreduce。