David 2 weeks ago
parent
commit
33ac3920ba
1 changed files with 23 additions and 13 deletions
  1. 23 13
      post_processing/cdq_coe_gen.py

+ 23 - 13
post_processing/cdq_coe_gen.py

@@ -160,8 +160,8 @@ def history_error(data, col_power, col_pre):
     # data.to_csv('J01080原始数据.csv', index=False)
     return data
 
-@app.route('/data_nwp_ftp', methods=['POST'])
-def get_nwp_from_ftp():
+@app.route('/cdq_coe_gen', methods=['POST'])
+def get_station_cdq_coe():
     # 获取程序开始时间
     start_time = time.time()
     result = {}
@@ -190,14 +190,24 @@ def get_nwp_from_ftp():
     return result
 
 if __name__ == "__main__":
-    args = {
-        'mongodb_database': 'ldw_ftp',
-        'mongodb_read_table': 'j00600',
-        # 'timeBegin': '2025-01-01 00:00:00',
-        # 'timeEnd': '2025-01-03 23:45:00'
-    }
-    data = get_data_from_mongo(args).sort_values(by='dateTime', ascending=True)
-    pre_data = history_error(data, col_power='realPower', col_pre='dq')
-    for point in range(0, 16, 1):
-        iterate_coe(pre_data, point, 'realPower', 'dq')
-    run_code = 0
+    # args = {
+    #     'mongodb_database': 'ldw_ftp',
+    #     'mongodb_read_table': 'j00600',
+    #     # 'timeBegin': '2025-01-01 00:00:00',
+    #     # 'timeEnd': '2025-01-03 23:45:00'
+    # }
+    # data = get_data_from_mongo(args).sort_values(by='dateTime', ascending=True)
+    # pre_data = history_error(data, col_power='realPower', col_pre='dq')
+    # for point in range(0, 16, 1):
+    #     iterate_coe(pre_data, point, 'realPower', 'dq')
+    # run_code = 0
+    print("Program starts execution!")
+    from waitress import serve
+
+    serve(
+        app,
+        host="0.0.0.0",
+        port=10123,
+        threads=8,  # 指定线程数(默认4,根据硬件调整)
+        channel_timeout=600  # 连接超时时间(秒)
+    )