Having difficulty in mapreduce to understand

2019-02-20 14:13发布

I have seen the below link which is of getting started mapreduce with python

http://code.google.com/p/appengine-mapreduce/wiki/GettingStartedInPython

But still I am not able to understand how its working. I am executing below code but not able to understand what exactly is happening?

mapreduce.yaml

mapreduce: 
- name: Testmapper 
   mapper: 
       input_reader: mapreduce.input_readers.DatastoreInputReader 
       handler: main.process 
   params: 
       - name: entity_kind 
         default: main.userDetail

mapreduce/main.py

some code

class userDetail(db.Model): 
name = db.StringProperty()

some code

def process(u): 
          u.name="mahesh" 
          yield op.db.Put(u)

I am executing this and it gives me status = success in status page.

But not able to understand what happend

The main thing I want do with mapreduce is to search or count records from entity

So anyone can please help me??

Thanks in advance

1条回答
啃猪蹄的小仙女
2楼-- · 2019-02-20 14:39

You are setting the "mahesh" value to the StringProperty name of all your userDetail entities.

If you want to count your entities use :

from mapreduce import operation as op
 def process(entity):
    yield op.counters.Increment("counter1")
查看更多
登录 后发表回答