예제 #1
0
now_time = time.time()
now_date = time.strftime('%Y%m%d', time.localtime(now_time))

date = get_update_ymd(MysqlTable.BASIC_INDEX_EVERYDAY, date_type='everyday')
date2 = get_update_ymd(MysqlTable.BASIC_INDEX_EVERYDAY_PRO,
                       date_type='everyday')
if date == date2:
    start_date = get_date(date, 1) if date else START_YMD
    end_date = get_date(now_date, -1)
    if int(start_date) <= int(end_date):
        dates = get_days(start_date, end_date)
        dates.sort(reverse=True)
        for date in dates:
            if isdataready(date):
                end_date = date
                add_partition(MysqlTable.BASIC_INDEX_EVERYDAY_PRO, end_date)
                add_partition(MysqlTable.BASIC_INDEX_EVERYDAY, end_date)
                active_devices(start_date,
                               end_date,
                               date_type='everyday',
                               insert=True)
                timevalid_active_devices(start_date,
                                         end_date,
                                         date_type='everyday',
                                         insert=True)
                launch_times(start_date,
                             end_date,
                             date_type='everyday',
                             insert=True)
                insert_update_time({
                    MysqlTable.BASIC_INDEX_EVERYDAY: {
예제 #2
0
now_time = time.time()
now_date = time.strftime('%Y%m%d', time.localtime(now_time))

date = get_update_ymdh(MysqlTable.BASIC_INDEX_HOUR, date_type='hour')
date2 = get_update_ymdh(MysqlTable.BASIC_INDEX_HOUR_PRO, date_type='hour')
if date == date2:
    start_date = get_date(date, 1) if date else START_YMDH
    end_date = get_date(now_date, -1) + '23'
    if int(start_date) <= int(end_date):
        # dates = get_hours(start_date, end_date)
        dates = get_days(start_date[:8], end_date[:8])
        dates.sort(reverse=True)
        for date in dates:
            if isdataready(date):
                end_date = date + '23'
                add_partition(MysqlTable.BASIC_INDEX_HOUR_PRO, end_date)
                add_partition(MysqlTable.BASIC_INDEX_HOUR, end_date)
                play_times(start_date, end_date, date_type='hour', insert=True)
                clicks(start_date, end_date, date_type='hour', insert=True)
                active_devices(start_date,
                               end_date,
                               date_type='hour',
                               insert=True)
                watch_time(start_date, end_date, date_type='hour', insert=True)
                use_time(start_date, end_date, date_type='hour', insert=True)
                launch_times(start_date,
                             end_date,
                             date_type='hour',
                             insert=True)
                total_devices(start_date,
                              end_date,