コード例 #1
0
ファイル: resultmanager.py プロジェクト: itsmeritesh/anuhak
 def post(self):
     resultType = self.request.get('resultType')
     clientCookie = self.request.cookies.get('BigKahuna', '')
     result = self.request.get('result')
     id= self.request.get('id')
     reduceQueue = reducequeue()
     reduceQueue.put(id,result)
     if resultType=="map":
       #remove from maptoken manager
       mtm = maptokenmanager()
       mtm.removeMapToken(clientCookie)
     	logging.info("Map result received" + resultType + ":" + result)
     else:
     	mycache = cache()      	
       curresult =mycache.get("reduceresult")
       if curresult == None:
       	if result.isdigit()==True:
       		mycache.put("reduceresult",result)
       else:
       	try:
       			logging.info(" Reduceresult is not null")
       		#if result.isdigit()==True and int(result)!=0:
       			curresult = int(curresult)
       			curresult = int(result) + curresult 
       			mycache.replace("reduceresult",curresult)
       	except:
       		logging.info("exception in ResultManager.py ")
       	
     	logging.info("Reduce result received:" + result) 
コード例 #2
0
ファイル: getdata.py プロジェクト: itsmeritesh/anuhak
 def get(self):
     clientCookie = self.request.cookies.get('BigKahuna', '')
     maploader = Maploader("blogs")
     map = maploader.getmap()         
     
     #add to maptokenmapping
     mtmanager = maptokenmanager()
     #mtmanager.putMapToken(map,clientCookie)
     workflow_type = self.getWorkflowType()
     
     if not map:
         admin = AdminData()
         if workflow_type=="gears":
         	admin.changeStatus("gearsmapreduce")
         else:
         	admin.changeStatus("reduce")
     else:
         self.response.out.write("{ \"data\": \"" + map.text +"\", \"id\":" + str(map.uniqueid) + "}")