|
@@ -1,3 +1,4 @@
|
|
|
+import random
|
|
|
import time
|
|
|
import os
|
|
|
|
|
@@ -60,7 +61,8 @@ def get_videos_remain_view_count(app_type, videos_info):
|
|
|
|
|
|
|
|
|
def get_score(video_ids):
|
|
|
- return [1] * len(video_ids)
|
|
|
+ # 以[0, 100]之间的随机浮点数作为score
|
|
|
+ return [random.uniform(0, 100) for _ in range(len(video_ids))]
|
|
|
|
|
|
|
|
|
def predict(app_type):
|
|
@@ -117,13 +119,18 @@ if __name__ == '__main__':
|
|
|
# res = get_videos_from_pool(app_type=0)
|
|
|
# res = get_videos_remain_view_count(app_type=0, videos_info=[('12345', '#2#1#111')])
|
|
|
# print(res)
|
|
|
+
|
|
|
log_.info('flow pool predict start...')
|
|
|
for app_name, app_type in config_.APP_TYPE.items():
|
|
|
log_.info('{} predict start...'.format(app_name))
|
|
|
predict(app_type=app_type)
|
|
|
log_.info('{} predict end...'.format(app_name))
|
|
|
log_.info('flow pool predict end...')
|
|
|
+
|
|
|
# # 将日志上传到oss
|
|
|
# log_cmd = "ossutil cp -r -f {} oss://{}/{}".format(log_.logname, config_.BUCKET_NAME,
|
|
|
# config_.OSS_FOLDER_LOGS + 'flow_pool/')
|
|
|
# os.system(log_cmd)
|
|
|
+
|
|
|
+ # res = get_score([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
|
|
+ # print(res)
|