|
@@ -55,6 +55,41 @@ def produce_video_data():
|
|
|
" where t1.project_id > %s and t1.project_id < %s and t1.app_type not in (1,13,15)) s1) ss1"%(start_time,end_time)
|
|
|
)
|
|
|
|
|
|
+
|
|
|
+def all_metric():
|
|
|
+ """视频合成类metrics"""
|
|
|
+
|
|
|
+ """视频合成成功率"""
|
|
|
+ start_time = int(time.strftime("%Y%m%d%H%M", time.localtime())) * 100000000000
|
|
|
+ end_time = (int(time.strftime("%Y%m%d%H%M", time.localtime())) + 5) * 100000000000
|
|
|
+ print(start_time, end_time)
|
|
|
+ query_sql = ("select totalCount , (successCount+processingCount1), round((successCount + processingCount1)/totalCount * 100,2) from "
|
|
|
+ "(select count(*) as totalCount,"
|
|
|
+ "sum(case when produce_status in (5,6,7,8) then 1 else 0 end) as successCount,"
|
|
|
+ "sum(case when produce_status = 99 then 1 else 0 end) as failCount , "
|
|
|
+ "sum(case when produce_status in(0,1,2,3,4) then 1 else 0 end) as processingCount,"
|
|
|
+ "sum(case when produce_status in(0,1,2,3,4) and (rate < 0.7 or rate is null) then 1 else 0 end) processingCount1,"
|
|
|
+ "sum(case when produce_status in(0,1,2,3,4) and rate >= 0.7 then 1 else 0 end) processingCount2 from "
|
|
|
+ "(select t1.project_id, t1.produce_status, round((t2.last_connect_timestamp - t1.submit_timestamp) / (t1.video_duration/1000), 1) as rate from produce_video_project t1 "
|
|
|
+ "left join produce_video_project_connect_time t2 on t1.project_id = t2.project_id "
|
|
|
+ "where t1.project_id > %s and t1.project_id < %s and t1.app_type not in (1,13,15)) s1) ss1" %(start_time ,end_time)
|
|
|
+
|
|
|
+ )
|
|
|
+ res = db_query(query_sql)
|
|
|
+ print(res)
|
|
|
+ if res[0] is not None:
|
|
|
+ total_cnt = res[0]
|
|
|
+ else:
|
|
|
+ total_cnt = 0
|
|
|
+ if res[1] is not None:
|
|
|
+ success_cnt = res[1]
|
|
|
+ else:
|
|
|
+ success_cnt = 0
|
|
|
+ if res[2] is not None:
|
|
|
+ rate = res[2]
|
|
|
+ else:
|
|
|
+ rate = 100
|
|
|
+ print(total_cnt,success_cnt,rate)
|
|
|
if __name__ == '__main__':
|
|
|
# with session_maker() as session:
|
|
|
# instance_info = session.query(InstanceList).filter(InstanceList.status==0).all()
|
|
@@ -290,9 +325,5 @@ if __name__ == '__main__':
|
|
|
# if res[0] is not None:
|
|
|
# print(res[0])
|
|
|
|
|
|
- from datetime import date, timedelta
|
|
|
-
|
|
|
- yesterday = (date.today() + timedelta(days=-1)).strftime("%Y%m%d")
|
|
|
- today = date.today().strftime("%Y%m%d")
|
|
|
- print(yesterday,today)
|
|
|
+ all_metric()
|
|
|
|