Jitendra12421 commited on
Commit
5e9fe90
·
verified ·
1 Parent(s): 40408cc

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -80,6 +80,10 @@ def cron_trigger(background_tasks: BackgroundTasks):
80
  # Run T+5 pipeline at 09:21
81
  background_tasks.add_task(run_update_pipeline, is_t5=True)
82
  return {"status": "triggered", "message": "Morning T+5 forecast pipeline started in the background."}
 
 
 
 
83
  else:
84
  return {"status": "skipped", "reason": f"Current time {current_time} is not in the execution windows (09:21-10:00 for T+5, after 15:45 for T+1)."}
85
 
 
80
  # Run T+5 pipeline at 09:21
81
  background_tasks.add_task(run_update_pipeline, is_t5=True)
82
  return {"status": "triggered", "message": "Morning T+5 forecast pipeline started in the background."}
83
+ elif not os.path.exists(PREDICTIONS_FILE_T5):
84
+ # Fallback: if file is missing (e.g. container restart), generate T+5 immediately
85
+ background_tasks.add_task(run_update_pipeline, is_t5=True)
86
+ return {"status": "triggered", "message": "Missing T+5 predictions. Generating them now in the background."}
87
  else:
88
  return {"status": "skipped", "reason": f"Current time {current_time} is not in the execution windows (09:21-10:00 for T+5, after 15:45 for T+1)."}
89