|
@@ -106,15 +106,16 @@ def get_next_target_time(current_time=None):
|
|
|
if current_time is None:
|
|
|
current_time = datetime.now(timezone('Asia/Shanghai'))
|
|
|
|
|
|
- target_hours = [0, 6, 12, 18]
|
|
|
+ # target_hours = [0, 6, 12, 18]
|
|
|
current_hour = current_time.hour
|
|
|
-
|
|
|
- for hour in sorted(target_hours):
|
|
|
- if current_hour <= hour:
|
|
|
- return current_time.replace(hour=hour, minute=0, second=0, microsecond=0)
|
|
|
-
|
|
|
- # 如果当前时间超过所有目标小时,使用次日0点
|
|
|
- return (current_time + timedelta(days=1)).replace(hour=0, minute=0, second=0, microsecond=0)
|
|
|
+ if current_hour >= 0 and current_hour <= 2:
|
|
|
+ return current_time.replace(hour=0, minute=0, second=0, microsecond=0)
|
|
|
+ elif current_hour >= 3 and current_hour <= 6:
|
|
|
+ return current_time.replace(hour=6, minute=0, second=0, microsecond=0)
|
|
|
+ elif current_hour >= 7 and current_hour <= 12:
|
|
|
+ return current_time.replace(hour=12, minute=0, second=0, microsecond=0)
|
|
|
+ else:
|
|
|
+ return current_time.replace(hour=18, minute=0, second=0, microsecond=0)
|
|
|
|
|
|
|
|
|
def download_files_via_sftp(mappings, datetime_str, local_temp_dir, model_type):
|
|
@@ -332,7 +333,7 @@ def configure_scheduler():
|
|
|
|
|
|
# 配置第一个触发器:处理每个主小时段的前 60 分钟(0-50 分钟)
|
|
|
trigger1 = CronTrigger(
|
|
|
- hour='23,5,11,17', # 主触发小时
|
|
|
+ hour='1,5,12,17', # 主触发小时
|
|
|
minute='0-50/10', # 每 10 分钟一次,覆盖 00:00-00:50
|
|
|
timezone='Asia/Shanghai' # 按需设置时区
|
|
|
)
|