出现错误“ImportError:找不到“input_readers”在路径“映射缩减”上尝试启动mapReduce作业

发布于 2024-12-10 02:01:42 字数 2581 浏览 0 评论 0原文

尝试通过 http://localhost:8080/mapreduce 启动器页面。

看来我的问题与这篇文章类似,AppEngine 映射器 API 导入错误。不幸的是,没有给出明确的答案。

我将其简化为这个小 testmapreduce.py:

from google.appengine.ext import db

class TestEntity(db.Model):
    value = db.StringProperty()

def mapperhandler(test):
    print test.value
    return

和我的 mapreduce.yaml:

mapreduce:
- name: Simplest MapReduce
  mapper:
    handler: testmapreduce.mapperhandler
    input_reader: mapreduce.input_readers.DatastoreInputReader
    params:
    - name: entity_kind
      default: testmapreduce.TestEntity

一个可能的线索是 __init__.py 的存在没有效果(无论是在项目根目录、mapreduce 目录还是两者中)。我确信我犯了一个初学者错误,但在过去的几天里,我阅读了所有文档以及我能找到的所有示例。谢谢。

更新: 我尝试通过...调用它时遇到相同的错误

control.start_map(
   "Give awards",
   "testmapreduce.mapperhandler",
   "mapreduce.input_readers.DatastoreInputReader",
   {"entity_kind": "testmapreduce.TestEntity"},
   shard_count=10)

更新: 根据要求,堆栈跟踪 - 让我知道还有什么会有帮助......

ERROR    2011-10-16 17:09:27,216 _webapp25.py:464] Could not find 'input_readers' on path 'mapreduce'
Traceback (most recent call last):
 File "/Develop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
   handler.get(*groups)
 File "/Users/lc/PycharmProjects/mrtest/testmapreduce.py", line 22, in get
   shard_count=10)      # handle web form test interface
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/control.py", line 94, in start_map
   transactional=transactional)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/handlers.py", line 811, in _start_map
   mapper_input_reader_class = mapper_spec.input_reader_class()
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/model.py", line 393, in input_reader_class
   return util.for_name(self.input_reader_spec)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/util.py", line 94, in for_name
   module = for_name(module_name, recursive=True)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/util.py", line 102, in for_name
   short_name, module_name))
ImportError: Could not find 'input_readers' on path 'mapreduce'
INFO     2011-10-16 22:09:27,253 dev_appserver.py:4247] "GET /giveawards HTTP/1.1" 500 -

I'm getting this error... "ImportError: Could not find 'input_readers' on path 'map reduce'" when trying to Run my map reduce job via the http://localhost:8080/mapreduce launcher page.

It looks like my problem is similar to this post, AppEngine mapper API import error. Unfortunately, no definitive answers were given.

I've simplified it down to this tiny testmapreduce.py:

from google.appengine.ext import db

class TestEntity(db.Model):
    value = db.StringProperty()

def mapperhandler(test):
    print test.value
    return

And my mapreduce.yaml:

mapreduce:
- name: Simplest MapReduce
  mapper:
    handler: testmapreduce.mapperhandler
    input_reader: mapreduce.input_readers.DatastoreInputReader
    params:
    - name: entity_kind
      default: testmapreduce.TestEntity

One possible clue is the presence of __init__.py has no effect (whether in the project root, the mapreduce directory, or both). I'm sure I'm making a beginner mistake, but over the last couple of days I have read every bit of documentation, and all the examples I can find. Thanks.

UPDATE:
I get the same error trying to invoke it via...

control.start_map(
   "Give awards",
   "testmapreduce.mapperhandler",
   "mapreduce.input_readers.DatastoreInputReader",
   {"entity_kind": "testmapreduce.TestEntity"},
   shard_count=10)

UPDATE:
As requested, the stack trace -- let me know what else would be helpful...

ERROR    2011-10-16 17:09:27,216 _webapp25.py:464] Could not find 'input_readers' on path 'mapreduce'
Traceback (most recent call last):
 File "/Develop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
   handler.get(*groups)
 File "/Users/lc/PycharmProjects/mrtest/testmapreduce.py", line 22, in get
   shard_count=10)      # handle web form test interface
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/control.py", line 94, in start_map
   transactional=transactional)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/handlers.py", line 811, in _start_map
   mapper_input_reader_class = mapper_spec.input_reader_class()
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/model.py", line 393, in input_reader_class
   return util.for_name(self.input_reader_spec)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/util.py", line 94, in for_name
   module = for_name(module_name, recursive=True)
 File "/Users/lc/PycharmProjects/mrtest/mapreduce/util.py", line 102, in for_name
   short_name, module_name))
ImportError: Could not find 'input_readers' on path 'mapreduce'
INFO     2011-10-16 22:09:27,253 dev_appserver.py:4247] "GET /giveawards HTTP/1.1" 500 -

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆追雨的时光 2024-12-17 02:01:42

这个问题原来是因为我在本地环境中使用了2.7版本的Python Interpreter。当我切换到2.5时,它工作得很好。

This problem turned out to be that I was using the 2.7 version of the Python Interpreter in my local environment. When I switched to 2.5, it works fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文