def get(self,client_id,num_programs): client_info = db.getClientInfo(client_id) problem_info = db.getProblem(client_info['problem_id']) if random() < problem_info['local_fetch_probability']/100.0: program_string = str(db.getProgramArray(db.getNeighborsForClient(client_id,num_programs))) else: strangers = db.getStrangersForClient(client_id,num_programs) programs = strangers + db.getNeighborsForClient(client_id,int(num_programs) - len(strangers)) program_string = str(db.getProgramArray(programs)) self.write(program_string) print "gave programs to client"
def get(self,client_id): problem_id=db.getClientInfo(client_id)['problem_id'] self.render("templates/gp_worker.js", fitness_cases=db.getFitnessCases(problem_id), gp_params=db.getGPParams(problem_id))