模型只保留一个,原油八大维度预测执行脚本更改
This commit is contained in:
		
							parent
							
								
									49a0998126
								
							
						
					
					
						commit
						eafd0f0b39
					
				| @ -199,7 +199,8 @@ def ex_Model(df, horizon, input_size, train_steps, val_check_steps, early_stop_p | ||||
|         nf_preds = nf_preds.reset_index() | ||||
|         # 保存模型 | ||||
|         # 生成文件名,按时间 精确到分 | ||||
|         filename = f'{settings}--{now}.joblib' | ||||
|         # filename = f'{settings}--{now}.joblib' | ||||
|         filename = f'{settings}.joblib' | ||||
|         # 文件名去掉冒号 | ||||
|         filename = filename.replace(':', '-')  # 替换冒号 | ||||
|         dump(nf, os.path.join(config.dataset, filename)) | ||||
|  | ||||
| @ -9,15 +9,15 @@ import time | ||||
| def run_predictions(target_date): | ||||
|     """执行三个预测脚本""" | ||||
|     scripts = [ | ||||
|         "main_yuanyou.py", | ||||
|         # "main_yuanyou.py", | ||||
|         "main_yuanyou_zhoudu.py", | ||||
|         "main_yuanyou_yuedu.py" | ||||
|     ] | ||||
| 
 | ||||
|     # 合并命令为单个进程执行 | ||||
|     command = ["python"] | ||||
|     command.extend(scripts) | ||||
|     subprocess.run(command, check=True) | ||||
|     # 依次执行每个脚本 | ||||
|     for script in scripts: | ||||
|         command = ["python", script] | ||||
|         subprocess.run(command, check=True) | ||||
| 
 | ||||
| 
 | ||||
| def is_weekday(date): | ||||
| @ -26,7 +26,9 @@ def is_weekday(date): | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     start_date = datetime.date(2025, 3, 13) | ||||
|     # start_date = datetime.date(2025, 3, 13) | ||||
|     # 开始时间取当前时间 | ||||
|     start_date = datetime.date.today() | ||||
|     end_date = datetime.date(2100, 12, 31) | ||||
| 
 | ||||
|     current_date = start_date | ||||
| @ -34,7 +36,7 @@ if __name__ == "__main__": | ||||
|         if is_weekday(current_date): | ||||
|             # 等待到目标日期的7点 | ||||
|             target_time = datetime.datetime.combine( | ||||
|                 current_date, datetime.time(9, 40)) | ||||
|                 current_date, datetime.time(10, 25)) | ||||
|             while datetime.datetime.now() < target_time: | ||||
|                 time.sleep(60)  # 每分钟检查一次 | ||||
|                 print(f"等待到 {target_time} 开始执行任务") | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user