run_all.py 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # ("models_processing/model_tf/tf_lstm_zone_pre.py", 10125),
  34. # ("models_processing/model_tf/tf_lstm_zone_train.py", 10124),
  35. #
  36. # ("post_processing/post_processing.py", 10098),
  37. # ("evaluation_processing/analysis.py", 10099),
  38. # ("models_processing/model_predict/res_prediction.py", 10105),
  39. # ("data_processing/data_operation/pre_data_ftp.py", 10101),
  40. # ("data_processing/data_operation/data_nwp_ftp.py", 10102),
  41. # ("models_processing/model_train/model_training_bp.py", 10103),
  42. # ("models_processing/model_predict/model_prediction_bp.py", 10104),
  43. # ("data_processing/data_operation/data_tj_nwp_ftp.py", 10106),
  44. # ("post_processing/pre_post_processing.py", 10107),
  45. # ("post_processing/cdq_coe_gen.py", 10123),
  46. # ("models_processing/model_predict/model_prediction_photovoltaic_physical.py", 10126),
  47. # ("data_processing/data_operation/hive_to_mongo.py", 10127),
  48. ("models_processing/model_train/model_training_ml.py", 10128),
  49. ("models_processing/model_predict/model_prediction_ml.py", 10129),
  50. ("post_processing/post_process.py", 10130)
  51. ]
  52. # 获取当前脚本所在的根目录
  53. base_dir = os.path.abspath(os.path.dirname(__file__))
  54. # 启动所有服务
  55. processes = []
  56. for service, port in services:
  57. service_path = os.path.join(base_dir, service)
  58. print(f"Starting {service} on port {port}")
  59. env = os.environ.copy()
  60. env["PYTHONPATH"] = base_dir # 设置 PYTHONPATH 为项目根目录
  61. p = subprocess.Popen(["python", service_path], env=env)
  62. processes.append(p)
  63. # 等待所有进程结束
  64. for p in processes:
  65. p.wait()