Commit f7f58d41 authored by 赵威's avatar 赵威

add exception checking

parent 763159f7
......@@ -8,13 +8,17 @@ from utils.cache import get_essm_model_save_path, redis_client4
def predict_with_city_changed(device_dict, diary_dict, tractate_dict, diary_predict_fn, tractate_predict_fn):
key = "doris:user_portrait:city_changed:device:queue"
total = redis_client4.llen(key)
while (total > 0):
device_id = redis_client4.lpop(key)
device_id = str(device_id, "utf-8")
offline_predict_diary(device_id, device_dict, diary_dict, diary_predict_fn)
offline_predict_tractate(device_id, device_dict, tractate_dict, tractate_predict_fn)
print("=========================================\n")
try:
total = redis_client4.llen(key)
while (total > 0):
device_id = redis_client4.lpop(key)
device_id = str(device_id, "utf-8")
print(device_id)
offline_predict_diary(device_id, device_dict, diary_dict, diary_predict_fn)
offline_predict_tractate(device_id, device_dict, tractate_dict, tractate_predict_fn)
print("=========================================\n")
except Exception as e:
print(e)
if __name__ == "__main__":
......@@ -36,4 +40,5 @@ if __name__ == "__main__":
tractate_save_path = "/home/gmuser/data/models/tractate/1596509299"
print(tractate_save_path + "!!!!!!!!!!!!!!!!!!!!!!!!!!!")
tractate_predict_fn = tf.contrib.predictor.from_saved_model(tractate_save_path)
predict_with_city_changed(device_dict, diary_dict, tractate_dict, diary_predict_fn, tractate_predict_fn)
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