Esempio n. 1
0
    def run(self):
#        global coctn
        fmain = ThreadPool(self.psize)
        while True:
            if not fetch_quere.empty() :
                fdata=[]
#                coctn=False
                for i in range(self.psize):
                    try:
                        fdata.append(fetch_quere.get(0))
                    except Exception,e:
                        print "-=-==================%s"%e
#                        coctn=True
                        continue
                
                frequests = makeRequests(self.runFunc, fdata, self.getResult)
                for freq in frequests:
                    fmain.putRequest(freq)
                time.sleep(0.5)
#                main.poll()
                fmain.wait()
#            else:
#                coctn=True
            time.sleep(0.5)
            print "gc fetchData------------->%s   ,    %s ,    %s"%(gc.collect(),len(gc.garbage),len(gc.get_objects()))
            del gc.garbage[:]
            print "-----------------> %s"%fetch_quere.qsize()
            print "%"*60
Esempio n. 2
0
    def run(self):
#        global coctn
        lmain = ThreadPool(len(self.data))
        while True:
            if fetch_quere.empty():
#                coctn=False
                lrequests = makeRequests(self.runFunc, self.data, self.getResult)
                for lreq in lrequests:
                    lmain.putRequest(lreq)
                lmain.wait()
            else:
                time.sleep(3)
            print "*"*80