def get_yesterday_log_filename(): # medical01_20171123_info_logger.log yesterday = get_yesterday_date() dir_name = "/home/classify/workspace/material_recommendation/info_log/" prefix1 = "medical01_" prefix2 = "medical02_" log_file_name1 = dir_name + prefix1 + yesterday + "_info_logger.log" log_file_name2 = dir_name + prefix2 + yesterday + "_info_logger.log" ana_file_name1 = log_file_name1 + "_analysis.csv" ana_file_name2 = log_file_name2 + "_analysis.csv" bdp_file_name1 = log_file_name1 + "_analysis.bdpinput" bdp_file_name2 = log_file_name2 + "_analysis.bdpinput" bdp_file_name = dir_name + yesterday + "_info_log.bdpinput" return log_file_name1, ana_file_name1, bdp_file_name1, log_file_name2, ana_file_name2, bdp_file_name2, bdp_file_name
import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import sys import json import time from general_utils.time_utils import get_yesterday_date from recommend.manager.feed_data_helper import get_all_yesterday_user_id from recommend.manager.recommend_resource import recommend_news_kernel from add_data_to_solr.manager.user_topn_news import add_a_part from recommend.daily_scripts.utils import get_parti_solr_filename, get_parti_uid_filename cut_num = 4 yesterday_date = get_yesterday_date() def save_uids(test=False): ''' 获取前一天活跃用户id,分成4份存在文件里(每份5000多个uid) :return: ''' all_valid_uids = get_all_yesterday_user_id(test=test) all_valid_uids = [str(x) for x in all_valid_uids] l = len(all_valid_uids) cut_index = [x * l / cut_num for x in range(cut_num + 1)] for i in range(cut_num): file_name = get_parti_uid_filename(i, 'news')
def get_caled_user_topn_topics_yesterday(uid): key = "%s|%s" % (get_yesterday_date(), uid) return get_caled_user_topn_topics(key)