|
@@ -77,7 +77,8 @@ def diag_cal():
|
|
|
df_diag_ram_sn.reset_index(inplace=True,drop=True)
|
|
|
chrg_last=df_diag_ram_sn.iloc[-1]
|
|
|
time_end=chrg_last['time_end']
|
|
|
-
|
|
|
+
|
|
|
+ logger.info("SN: {} 数据开始模型预测".format(sn))
|
|
|
df_diag_new,df_diag_change=pro_output(df_merge,sn,gpscity,chrg_last)
|
|
|
|
|
|
df_diag_new=prediction(df_diag_new,kmeans1,kmeans2,kmeans3,kmeans4,kmeans5)
|
|
@@ -86,13 +87,15 @@ def diag_cal():
|
|
|
cursor.execute("DELETE FROM algo_charge_info WHERE time_end = '{}' and sn='{}'".format(time_end,sn))
|
|
|
mysql.commit()
|
|
|
df_diag_change.to_sql("algo_charge_info",con=db_res_engine, if_exists="append",index=False)
|
|
|
+ logger.info("SN: {} 更新结果库成功".format(sn))
|
|
|
|
|
|
#新增结果存入结果库.....................................................................
|
|
|
if not df_diag_new.empty: #需新增的结果非空
|
|
|
df_diag_new.to_sql("algo_charge_info",con=db_res_engine, if_exists="append",index=False)
|
|
|
+ logger.info("SN: {} 新增结果库成功".format(sn))
|
|
|
|
|
|
- end=time.time()
|
|
|
- print(end-start)
|
|
|
+ # end=time.time()
|
|
|
+ # print(end-start)
|
|
|
|
|
|
except Exception as e:
|
|
|
logger.error(str(e))
|
|
@@ -152,6 +155,7 @@ if __name__ == "__main__":
|
|
|
kmeans3 = joblib.load('D:/deploy/python_platform/data_analyze_platform/LIB/MIDDLE/InfoChrgDrive/Charge/kmeans3.pkl')
|
|
|
kmeans4 = joblib.load('D:/deploy/python_platform/data_analyze_platform/LIB/MIDDLE/InfoChrgDrive/Charge/kmeans4.pkl')
|
|
|
kmeans5 = joblib.load('D:/deploy/python_platform/data_analyze_platform/LIB/MIDDLE/InfoChrgDrive/Charge/kmeans5.pkl')
|
|
|
+ logger.info("模型加载完成")
|
|
|
|
|
|
diag_cal()
|
|
|
#定时任务.......................................................................................................................................................................
|