def calcWorker(self, worker_id):
        while (self.go.value):
            # Take ORDER
            if self.workers_query_result_q.qsize() > 3:
                print "Warning: the queue is containing %d elements" % (
                    self.workers_query_result_q.qsize())
            order = self.workers_query_result_q.get()
            profile = order["profile"]
            profile_srtm = order["profile_srtm"]
            id1 = order["id1"]
            id2 = order["id2"]
            # Normal profile
            try:
                link = Link(profile)
                loss, status = link.loss_calculator()

            except (ZeroDivisionError, ProfileException), e:
                loss = 0
                status = -1
            # Downscaled profile
            try:
                link_ds = Link(profile)
                loss_ds, status_ds = link_ds.loss_calculator(downscale=3)
            except (ZeroDivisionError, ProfileException), e:
                loss_ds = 0
                status_ds = -1
                         password='******',
                         host='192.168.184.102')
 cur = conn.cursor()
 working_area = (4.8411, 45.7613, 4.8528, 45.7681)
 tf = terrain_RF(cur=cur, dataset='lyon_srtm', working_area=working_area)
 buildings = tf.get_buildings()
 dict_h = dict(buildings)
 id1, id2 = 81747, 81823
 p1 = (0.0, dict_h[id1])
 p2 = (tf.distance(id1, id2), dict_h[id2])
 try:
     profile = tf.profile_osm(id1, id2, p1, p2)
     link = Link(profile)
 except ProfileException, e:
     print e
 link.loss_calculator()
 link.plot()
 #buildings = tf.get_buildings(11.234, 43.758, 11.285, 43.787) FIRENZE
 # tf.set_workingarea(4.8411, 45.7613, 4.8528, 45.7681)
 # buildings = tf.get_buildings()
 # gid, h = zip(*buildings)
 # buildings_pair = list(itertools.combinations(gid, 2))
 # shuffle(buildings_pair)
 # link_filename = "../data/"+tf.dataset+"_links.csv"
 # with open(link_filename, 'a') as fl:
 #     print >> fl, "b1,b2,status,loss,status_downscale,loss_downscale"
 # for building in buildings_pair:
 #     id1 = building[0]
 #     id2 = building[1]
 #     try:
 #         profile = tf.profile_osm(id1, id2)