2.7转换后Mapreduce不再有效

时间:2012-09-12 01:04:16

标签: multithreading google-app-engine mapreduce python-2.7

将我们的应用程序转换为Python 2.7,配置多线程,并在app.yaml中引用mapreduce,就像这样......

- url: /mapreduce(/.*)?
  script: mapreduce.main.app
  #script: google.appengine.ext.mapreduce.main.app
  login: admin

并像这样调用mapreduce ......

  control.start_map(
      "FNFR",
      "fnfr.fnfrHandler",
      "mapreduce.input_readers.BlobstoreLineInputReader",
      {"blob_keys": blobKey},
      shard_count=32,
      mapreduce_parameters={'done_callback': '/fnfrdone','blobKey': blobKey, 'userID':thisUserID})

我们得到以下堆栈跟踪...

Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 189, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 241, in _LoadHandler
    raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'mapreduce.main' from '/base/data/home/apps/s~xxxxxxonline/2.361692533819432574/mapreduce/main.pyc'> has no attribute app 

我找到了一个SO引用(How to migrate my app.yaml to 2.7?)但是从我的yaml可以看出,我想我已经尝试了所有组合来尝试解决它。谢谢。

1 个答案:

答案 0 :(得分:5)

这对我有用,但是我仍然使用相当旧版本的SDK,我不知道他们是否解决了这个问题:

- url: /mapreduce(/.*)?
  script: mapreduce.main.APP
  login: admin