def POST(self): global Work global client_port cprint("Data received, saving!", 'okgreen') save = open("MultiHeaded-analisys.csv", 'a') save.write(web.data()) save.close() cprint("Sending next!", 'okgreen') work_append( web.ctx['ip'], client_port, Work.pop(1,1)) work_start(web.ctx['ip'], client_port)
response = requests.get(ip_port(client,client_port)+"/cores").text success = True except requests.exceptions.ConnectionError: cprint("Cannot connect to %s" % (client),'fail') cprint("Retry in 1 sec", 'info') sleep(1) info[client]["cores"] = json.loads(response)["cores"] info[client]["multiplier"] = json.loads(response)["multiplier"] #Add work to queue. Will be started when everyone get it's own #(that way we can start the server that receive the results in time) #Append a work for every core of every client for client_ip in info: cprint("Loading data for %s" % client_ip, 'info') work_append( client_ip, client_port, Work.pop( info[client_ip]["cores"] , info[client_ip]["multiplier"])) #Really start the queue cprint("Starting all queued",'info') for client_ip in info: work_init(client_ip, client_port) #Wait for answers! print("Waiting replys on: %s:%s" % (get_self_ip(), port)) app.run(port)