Commit 18aa408c authored by 赵威's avatar 赵威

add grey

parent b48b9ccd
......@@ -7,6 +7,7 @@ import tensorflow as tf
from models.esmm.fe import (get_device_dict_from_redis, get_diary_dict_from_redis)
from models.esmm.model import model_predict_diary
from utils.cache import redis_client2
from utils.grey import recommed_service_category_device_id_by_tail
from utils.portrait import (user_portrait_tag3_get_candidate_dict, user_portrait_tag3_get_candidate_unread_list,
user_portrait_tag3_write_ctcvr_data)
......@@ -25,10 +26,11 @@ def user_portrait_scan_info(device_dict, diary_dict, predict_fn):
key = str(key, "utf-8")
device_id = key.split(":")[-1]
if (user_portrait_tag3_get_candidate_dict(device_id, "diary")):
all_count += 1
print(str(all_count) + ": " + device_id)
offline_predict(device_id, device_dict, diary_dict, predict_fn)
if recommed_service_category_device_id_by_tail(device_id, ["c", "d", "e", "f"]):
if (user_portrait_tag3_get_candidate_dict(device_id, "diary")):
all_count += 1
print(str(all_count) + ": " + device_id)
offline_predict(device_id, device_dict, diary_dict, predict_fn)
print("all count: " + str(all_count))
print("scan done " + str(datetime.datetime.now()))
......
import hashlib
def recommed_service_category_device_id_by_tail(device_id, tail_list=[]):
try:
"""设备品类显示, 是否命中灰度"""
if not device_id:
return False
hd_id = hashlib.md5(str(device_id).encode()).hexdigest()
is_gray = hd_id[-1] in tail_list
return is_gray
except Exception as e:
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment