def execute(self, params): ''' Parameters: 1 page content 2 nameextractiontuples 3 pricextractiontuples Returns: name price_currency is_current_price is_lowest_price is_highest_price is_old_price is_vip_price (optional) current_price (optional) lowest_price (optional) highest_price (optional) old_price (optional) vip_price ''' #sys.path.insert(0,'/home/lequocdo/workspace/leadsdm') #print sys.path params = translateInputParameters(sys.argv) page_content = params[0] page_tree = xpathops.content2tree(page_content) page_dict = {"tree": page_tree} name_extraction_tuples_list = ast.literal_eval(params[1]) price_extraction_tuples_list = ast.literal_eval(params[2]) values_extractor = ExtractValues(page_dict) default_verifier = defaultverifier() values_extractor.extract(name_extraction_tuples_list, default_verifier)
def execute(self,params): ''' Parameters: 1 page content 2 nameextractiontuples 3 pricextractiontuples Returns: name price_currency is_current_price is_lowest_price is_highest_price is_old_price is_vip_price (optional) current_price (optional) lowest_price (optional) highest_price (optional) old_price (optional) vip_price ''' #sys.path.insert(0,'/home/lequocdo/workspace/leadsdm') #print sys.path params = translateInputParameters(sys.argv) page_content = params[0] page_tree = xpathops.content2tree(page_content) page_dict = {"tree":page_tree} name_extraction_tuples_list = ast.literal_eval(params[1]) price_extraction_tuples_list = ast.literal_eval(params[2]) values_extractor = ExtractValues(page_dict) default_verifier = defaultverifier() values_extractor.extract(name_extraction_tuples_list, default_verifier)
''' Created on Jul 28, 2014 @author: nonlinear ''' from eu.leads.infext.python.CLAPI.conversionmethods import translateInputParameters import sys if __name__ == '__main__': params = translateInputParameters(sys.argv) print params[0]
returnlist.append(str(clusterPages.category_cluster_50pc_dist)) returnlist.append(str(clusterPages.category_cluster_80pc_dist)) returnlist.append(str(clusterPages.pd.mean.tolist())) returnlist.append(str(clusterPages.pd.std.tolist())) returnlist.append(str(clusterPages.product_pages_indices_list)) returnlist.append(str(clusterPages.category_pages_indices_list)) print '///' print type(clusterPages.product_cluster_center) print clusterPages.product_cluster_center print '///' #processing_off(processing) #print translateReturnValues(returnlist) #return translateReturnValues(returnlist) self.logger.debug(returnlist) return returnlist ################################################################# if __name__ == "__main__": #pdb.set_trace() params = translateInputParameters(["eu.leads.infext.python.CLAPI.determineschemaforthesite_clinterface","paramsfile:/tmp/leadsjavapy-150306195527764495"]) ap = AccessPoint() #pdb.set_trace() ap.execute(params) pass
returnlist.append(str(clusterPages.category_cluster_80pc_dist)) returnlist.append(str(clusterPages.pd.mean.tolist())) returnlist.append(str(clusterPages.pd.std.tolist())) returnlist.append(str(clusterPages.product_pages_indices_list)) returnlist.append(str(clusterPages.category_pages_indices_list)) print '///' print type(clusterPages.product_cluster_center) print clusterPages.product_cluster_center print '///' #processing_off(processing) #print translateReturnValues(returnlist) #return translateReturnValues(returnlist) self.logger.debug(returnlist) return returnlist ################################################################# if __name__ == "__main__": pdb.set_trace() params = translateInputParameters([ "eu.leads.infext.python.CLAPI.determineschemaforthesite_clinterface", "paramsfile:/tmp/leadsjavapy-150306195527764495" ]) ap = AccessPoint() pdb.set_trace() ap.execute(params) pass
logger.debug("In the loop") msg = server.recv_multipart() logging.debug("msg: %s" % str(msg)) if not msg: break # Interrupted # read message # pt.1 module name logger.debug("module name: %s" % msg[0]) ap = None try: ap = factory(msg[0]) # pt.2 all of the params paramstr = str([text for text in msg[1:]]) logger.debug("input params: %s" % paramstr) params = translateInputParameters(msg) except: logger.debug("UNEXPECTED EXCEPTION in the main module: %s" % str(traceback.format_exc())) break # call a class with all of the params as list retval = "" try: retval = ap.execute(params) logger.debug(retval) except: logger.debug("EXCEPTION during module %s execution: %s" % (msg[0], str(traceback.format_exc()))) server.send_json(retval) logger.debug("finishing") server.setsockopt(zmq.LINGER, 0) # Terminate immediately