【问题标题】:Mapreduce no longer works after 2.7 conversionMapreduce 在 2.7 转换后不再工作
【发布时间】:2012-09-04 23:42:53
【问题描述】:

在将我们的应用程序转换为 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 中看到的那样,我想我已经尝试了所有组合来尝试解决它。谢谢。

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 我认为这让我更进一步,谢谢。下一个问题——不知道它是否相关——但现在看起来 mapreduce 对 worker_callback 的调用以“TypeError:__init__() 最多需要 2 个参数(3 个给定)”而失败。我现在想知道我是否以某种方式得到了错误的 mapreduce 版本。
    • 重要提示:好的,我已经搞定了。除了@dragonx 的解决方案,我还必须下载并拉入最新的 MapReduce 源代码,并将 mapreduce/include.yaml 中的行更改为看起来像这样的“脚本:mapreduce.main.APP”。并且在这两个地方都需要全部大写的APP。最后一点,我看到一个帖子说如果你正在使用 mapreduce 的管道部分(不仅仅是映射器),此时你需要一个补丁。基本上,我认为我们使用的 mapreduce 版本尚未针对 2.7 多线程进行更新。
    • 现在太久远了,但通过SDK代码调试并不难。
    猜你喜欢
    • 1970-01-01
    • 2016-09-12
    • 1970-01-01
    • 1970-01-01
    • 2018-06-01
    • 2017-10-19
    • 2015-02-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多