run_all.py 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import subprocess
  2. import os
  3. # 定义要启动的应用及其路径和端口
  4. services = [
  5. ("data_processing/data_operation/data_join.py", 10094),
  6. ("data_processing/data_operation/mysql_to_mongo.py", 10095),
  7. ("data_processing/data_operation/pre_prod_ftp.py", 10118),
  8. ("data_processing/processing_limit_power/processing_limit_power_by_agcavc.py", 10086),
  9. ("data_processing/processing_limit_power/processing_limit_power_by_machines.py", 10087),
  10. ("data_processing/processing_limit_power/processing_limit_power_by_records.py", 10088),
  11. ("data_processing/processing_limit_power/processing_limit_power_by_statistics_light.py", 10085),
  12. ("data_processing/processing_limit_power/processing_limit_power_by_statistics_wind.py", 10093),
  13. ("data_processing/data_operation/pre_prod_ftp.py", '_'),
  14. ("evaluation_processing/analysis_report.py", 10092),
  15. ("evaluation_processing/evaluation_accuracy.py", 10091),
  16. ("evaluation_processing/analysis_cdq.py", 10108),
  17. ("models_processing/model_train/model_training_lightgbm.py", 10089),
  18. ("models_processing/model_predict/model_prediction_lightgbm.py", 10090),
  19. ("models_processing/model_train/model_training_lstm.py", 10096),
  20. ("models_processing/model_predict/model_prediction_lstm.py", 10097),
  21. ("models_processing/model_tf/tf_bp_pre.py", 10110),
  22. ("models_processing/model_tf/tf_bp_train.py", 10111),
  23. ("models_processing/model_tf/tf_cnn_pre.py", 10112),
  24. ("models_processing/model_tf/tf_cnn_train.py", 10113),
  25. ("models_processing/model_tf/tf_lstm_pre.py", 10114),
  26. ("models_processing/model_tf/tf_lstm_train.py", 10115),
  27. ("models_processing/model_tf/tf_test_pre.py", 10116),
  28. ("models_processing/model_tf/tf_test_train.py", 10117),
  29. ("models_processing/model_tf/tf_lstm2_pre.py", 10120),
  30. ("models_processing/model_tf/tf_lstm2_train.py", 10119),
  31. ("models_processing/model_tf/tf_lstm3_pre.py", 10122),
  32. ("models_processing/model_tf/tf_lstm3_train.py", 10121),
  33. ("post_processing/post_processing.py", 10098),
  34. ("evaluation_processing/analysis.py", 10099),
  35. ("models_processing/model_predict/res_prediction.py", 10105),
  36. ("data_processing/data_operation/pre_data_ftp.py", 10101),
  37. ("data_processing/data_operation/data_nwp_ftp.py", 10102),
  38. ("models_processing/model_train/model_training_bp.py", 10103),
  39. ("models_processing/model_predict/model_prediction_bp.py", 10104),
  40. ("data_processing/data_operation/data_tj_nwp_ftp.py", 10106),
  41. ("post_processing/pre_post_processing.py", 10107),
  42. ("post_processing/cdq_coe_gen.py", 10123),
  43. ]
  44. # 获取当前脚本所在的根目录
  45. base_dir = os.path.abspath(os.path.dirname(__file__))
  46. # 启动所有服务
  47. processes = []
  48. for service, port in services:
  49. service_path = os.path.join(base_dir, service)
  50. print(f"Starting {service} on port {port}")
  51. env = os.environ.copy()
  52. env["PYTHONPATH"] = base_dir # 设置 PYTHONPATH 为项目根目录
  53. p = subprocess.Popen(["python", service_path], env=env)
  54. processes.append(p)
  55. # 等待所有进程结束
  56. for p in processes:
  57. p.wait()