def __init__(self): threading.Thread.__init__(self) self.bf = bloomfilter().getinstance() self.mdb = memdb() self.taskname = self.get_task_name() self.workername = self.get_worker_name() pass
def __init__(self,openers,task_dispatcher,result_handler=None): self.task_dispatcher = task_dispatcher self.result_handler = result_handler self.openers = openers self.mdb = memdb() self.worker_name = self.get_worker_name() self.mdb.dict_update(self.worker_name,'IDLE') self.canrun = True pass
def start_weibo_work(task): mdb = memdb() docname = 'weibo_'+task tasks = request.forms.get("tasks") mdb.push(docname,tasks) worker_status = mdb.dict_show('weibo') if worker_status != "BUSY": mdb.cleandoc(docname) if task == "followers": wf = weibofollowmanager().start() pass elif task == "miniblog": wm = weibominiblogmanager().start() pass pass
#!/usr/bin/env python #coding=utf-8 import sys sys.path.append('../') from factory.supports.memdb import memdb from factory.managers.weibomanager import weibominiblogmanager if sys.getdefaultencoding() != "utf-8": reload(sys) sys.setdefaultencoding('utf-8') if __name__ == "__main__": task = 'miniblogs' mdb = memdb() docname = 'weibo_'+task+'!TASK' print docname #tasks = ['3310333102'] tasks = [('2482256271','0')] mdb.push(docname,tasks) worker_status = mdb.dict_show('weibo') if worker_status != "BUSY": if task == "followers": wf = weibofollowmanager().start() pass elif task == "miniblogs": wm = weibominiblogmanager().start() pass print "---------------"
def __init__(self): self.result = RESULT_URL_PREFIX self.mdb = memdb() pass
#!/usr/bin/env python #coding=utf-8 import sys sys.path.append('../') from factory.supports.memdb import memdb from factory.managers.weibomanager import weibominiblogmanager if sys.getdefaultencoding() != "utf-8": reload(sys) sys.setdefaultencoding('utf-8') if __name__ == "__main__": task = 'miniblogs' mdb = memdb() docname = 'weibo_' + task + '!TASK' print docname #tasks = ['3310333102'] tasks = [('2482256271', '0')] mdb.push(docname, tasks) worker_status = mdb.dict_show('weibo') if worker_status != "BUSY": if task == "followers": wf = weibofollowmanager().start() pass elif task == "miniblogs": wm = weibominiblogmanager().start() pass print "---------------"
#!/usr/bin/env python #coding=utf-8 import sys sys.path.append('../') from factory.supports.memdb import memdb from factory.managers.weibomanager import weibofollowmanager if __name__ == "__main__": task = 'followers' mdb = memdb() docname = 'weibo_'+task+'!TASK' print docname #tasks = ['3310333102'] tasks = ['2482256271'] mdb.push(docname,tasks) mdb1 = memdb() worker_status = mdb.dict_show('weibo') if worker_status != "BUSY": if task == "followers": wf = weibofollowmanager().start() pass elif task == "miniblog": wm = weibominiblogmanager().start() pass print "---------------"
#!/usr/bin/env python #coding=utf-8 import sys sys.path.append('../') from factory.supports.memdb import memdb from factory.managers.weibomanager import weibofollowmanager if __name__ == "__main__": task = 'followers' mdb = memdb() docname = 'weibo_' + task + '!TASK' print docname #tasks = ['3310333102'] tasks = ['2482256271'] mdb.push(docname, tasks) mdb1 = memdb() worker_status = mdb.dict_show('weibo') if worker_status != "BUSY": if task == "followers": wf = weibofollowmanager().start() pass elif task == "miniblog": wm = weibominiblogmanager().start() pass print "---------------"