def main(): """This script deletes existing category indexes and recreates them.""" db.DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById('category') catIdx = im.getIndex('category') ch = CategoryManager() totnum = len(ch.getList()) curnum = 0 curper = 0 for cat in ch.getList(): while 1: try: for conf in cat.getConferenceList(): catIdx.indexConf(conf) transaction.commit() break except: db.DBMgr.getInstance().sync() curnum += 1 per = int(float(curnum)/float(totnum)*100) if per != curper: curper = per print "%s%%" % per db.DBMgr.getInstance().endRequest()
def main(): """This script deletes existing category indexes and recreates them.""" db.DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById('categoryDate') catIdx = im.getIndex('categoryDate') ch = CategoryManager() totnum = len(ch.getList()) curnum = 0 curper = 0 for cat in ch.getList(): while 1: try: for conf in cat.getConferenceList(): catIdx.indexConf(conf) transaction.commit() break except: db.DBMgr.getInstance().sync() curnum += 1 per = int(float(curnum)/float(totnum)*100) if per != curper: curper = per print "%s%%" % per db.DBMgr.getInstance().endRequest()
def main(): DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById('calendar') DBMgr.getInstance().commit() ch = CategoryManager() list = ch.getList() totnum = len(list) curnum = 0 curper = 0 for cat in list: committed = False DBMgr.getInstance().sync() calindex = im.getIndex('calendar') while not committed: try: del cat._calIdx except: pass for conf in cat.getConferenceList(): calindex.indexConf(conf) try: DBMgr.getInstance().commit() committed = True except: DBMgr.getInstance().abort() print "retry %s" % cat.getId() curnum += 1 per = int(float(curnum) / float(totnum) * 100) if per != curper: curper = per if per in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]: print "done %s%%" % per DBMgr.getInstance().endRequest()
def main(): DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById("calendar") DBMgr.getInstance().commit() ch = CategoryManager() list = ch.getList() totnum = len(list) curnum = 0 curper = 0 for cat in list: committed = False DBMgr.getInstance().sync() calindex = im.getIndex("calendar") while not committed: try: del cat._calIdx except: pass for conf in cat.getConferenceList(): calindex.indexConf(conf) try: DBMgr.getInstance().commit() committed = True except: DBMgr.getInstance().abort() print "retry %s" % cat.getId() curnum += 1 per = int(float(curnum) / float(totnum) * 100) if per != curper: curper = per if per in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]: print "done %s%%" % per DBMgr.getInstance().endRequest()
def main(): """This script deletes existing category indexes and recreates them.""" db.DBMgr.getInstance().startRequest() ch = CategoryManager() for cat in ch.getList(): for conf in cat.getConferenceList(): chconf(conf) get_transaction().commit() # Tasks htl = timerExec.HelperTaskList.getTaskListInstance() for task in htl.getTasks(): chtask(task) db.DBMgr.getInstance().endRequest()
def main(): """This script deletes existing category indexes and recreates them.""" db.DBMgr.getInstance().startRequest() ch = CategoryManager() for cat in ch.getList(): for conf in cat.getConferenceList(): chconf(conf) get_transaction().commit() # Tasks htl = timerExec.HelperTaskList.getTaskListInstance() for task in htl.getTasks(): chtask(task) db.DBMgr.getInstance().endRequest()
def main(): """This script deletes existing category indexes and recreates them.""" dbi = db.DBMgr.getInstance() dbi.startRequest() im = indexes.IndexesHolder() im.removeById('categoryName') catIdx = im.getIndex('categoryName') ch = CategoryManager() totnum = len(ch.getList()) curnum = 0 curper = 0 for cat in ch.getList(): while 1: print cat.getId(), cat.getTitle() catIdx.index(cat.getId(), cat.getTitle().decode('utf-8')) dbi.commit() break curnum += 1 per = int(float(curnum)/float(totnum)*100) if per != curper: curper = per print "%s%%" % per dbi.endRequest()
def main(): """This script deletes existing category indexes and recreates them.""" dbi = db.DBMgr.getInstance() dbi.startRequest() im = indexes.IndexesHolder() im.removeById('categoryName') catIdx = im.getIndex('categoryName') ch = CategoryManager() totnum = len(ch.getList()) curnum = 0 curper = 0 for cat in ch.getList(): while 1: print cat.getId(), cat.getTitle() catIdx.index(cat.getId(), cat.getTitle().decode('utf-8')) dbi.commit() break curnum += 1 per = int(float(curnum) / float(totnum) * 100) if per != curper: curper = per print "%s%%" % per dbi.endRequest()
def updateCategsAndEvents(): DBMgr.getInstance().startRequest() cm = CategoryManager() l = [cat.getId() for cat in cm.getList()] DBMgr.getInstance().endRequest() for id in l: DBMgr.getInstance().startRequest() cat = cm.getById(id) log("\nupdate category %s:%s"%(cat.getId(), cat.getName())) if cat.getId() in catTZMap.keys() and catTZMap[cat.getId()] : tz = catTZMap[cat.getId()] log(" found tz for this category: %s"%tz) else: tz = defTZ log(" use default tz: %s"%tz) cat.setTimezone(tz) updateCatTasks(cat) for conf in cat.getConferenceList(): updateEvent(conf, tz) log(" conf %s: %s updated with tz: %s"%(conf.getId(), conf.getTitle(), tz)) DBMgr.getInstance().endRequest()
def updateCalendarIndex(): DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById('calendar') DBMgr.getInstance().commit() ch = CategoryManager() list = ch.getList() totnum = len(list) curnum = 0 curper = 0 for cat in list: committed = False DBMgr.getInstance().sync() calindex = im.getIndex('calendar') while not committed: try: del cat._calIdx except: pass for conf in cat.getConferenceList(): try: calindex.indexConf(conf) except Exception, e: log("%s" % e) log("calindex: exception indexing [%s] sd:%s, ed:%s" % (conf.getId(), conf.getStartDate(), conf.getEndDate())) try: DBMgr.getInstance().commit() committed = True except: DBMgr.getInstance().abort() log("retry %s" % cat.getId()) curnum += 1 per = int(float(curnum) / float(totnum) * 100) if per != curper: curper = per if per in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]: log("done %s%%" % per)
def updateCalendarIndex(): DBMgr.getInstance().startRequest() im = indexes.IndexesHolder() im.removeById('calendar') DBMgr.getInstance().commit() ch = CategoryManager() list = ch.getList() totnum = len(list) curnum = 0 curper = 0 for cat in list: committed = False DBMgr.getInstance().sync() calindex = im.getIndex('calendar') while not committed: try: del cat._calIdx except: pass for conf in cat.getConferenceList(): try: calindex.indexConf(conf) except Exception,e: log("%s"%e) log("calindex: exception indexing [%s] sd:%s, ed:%s"%(conf.getId(),conf.getStartDate(), conf.getEndDate())) try: DBMgr.getInstance().commit() committed = True except: DBMgr.getInstance().abort() log("retry %s" % cat.getId()) curnum += 1 per = int(float(curnum)/float(totnum)*100) if per != curper: curper = per if per in [0,10,20,30,40,50,60,70,80,90,100]: log("done %s%%" % per)