def update_combs_imp(now, minute_duration): threads = [] for comb in Comb.comb: t = threading.Thread(target=Imp.update_comb_imp, args=(comb, OrderItems.ods, now, minute_duration)) t.start() threads.append(t) ThreadUtils.wait_until_done(threads)
def update_all_imp(): now = datetime.datetime.now().replace(second=0, microsecond=0) - datetime.timedelta(hours=8) threads = [] od_thread = threading.Thread(target=Imp.update_od_imp, args=(now, 1440)) combs_thread = threading.Thread(target=Imp.update_combs_imp, args=(now, 1440)) od_thread.start() combs_thread.start() threads.append(od_thread) threads.append(combs_thread) ThreadUtils.wait_until_done(threads) LogUtils.info("Finish the data init process!")
def update_latest_imp(): now = datetime.datetime.now().replace(second=0, microsecond=0) - datetime.timedelta(hours=8) LogUtils.info("Last updated Beijing time: %s" % (now + datetime.timedelta(hours=8))) threads = [] od_thread = threading.Thread(target=Imp.update_od_imp, args=(now, 15)) combs_thread = threading.Thread(target=Imp.update_combs_imp, args=(now, 15)) threads.append(od_thread) threads.append(combs_thread) od_thread.start() combs_thread.start() ThreadUtils.wait_until_done(threads) Imp.delete_obs_data(Imp.order_item_imp, now) Imp.delete_obs_data(Imp.comb_imp, now)