@@ -354,7 +354,7 @@ configure_parallelism() {
354354configure_hpo_extras () {
355355 local -n _extra=$1
356356 if [[ " ${HP_SEARCH} " == " yes" ]]; then
357- _extra+=(+hp_search=bayesian hp_search.n_trials=" ${HP_TRIALS:- 100 } " )
357+ _extra+=(+hp_search=bayesian hp_search.n_trials=" ${HP_TRIALS:- 20 } " )
358358 _extra+=(
359359 " hp_search.storage.url=sqlite:///${TMPDIR:-/ tmp} /optuna_${SLURM_JOB_ID} _${SLURM_ARRAY_TASK_ID} .db"
360360 )
@@ -482,13 +482,35 @@ plan_walk_forward_seeds() {
482482}
483483
484484# Single-seed walk-forward task (GPU manifest with 8th column). Sets WF_RUN_DIR, WF_START_SEED, WF_RUN_REPS=1.
485- # Returns 0 run, 1 skip (seed present), 2 error (seed>base without run dir).
485+ # Returns 0 run, 1 skip (seed present), 2 error (timed out waiting for base-seed run dir).
486486plan_walk_forward_single_seed () {
487487 local crop=$1 country=$2 model_slug=$3 seed=$4
488488 local base=${WF_BASE_SEED:- 42}
489489 local run_dir=" "
490+ local wait_secs=${WF_SEED_WAIT_SECS:- 7200}
491+ local interval=${WF_SEED_WAIT_INTERVAL:- 30}
492+ local elapsed=0
493+
494+ # Parallel per-seed arrays may start seed 43+ before seed ${base} creates the run dir.
495+ while true ; do
496+ run_dir=$( find_latest_walk_forward_run_dir " ${crop} " " ${country} " " ${model_slug} " )
497+ if [[ -n " ${run_dir} " && -d " ${run_dir} " ]]; then
498+ break
499+ fi
500+ if [[ " ${seed} " == " ${base} " ]]; then
501+ break
502+ fi
503+ if [[ " ${elapsed} " -eq 0 ]]; then
504+ echo " [WAIT] Seed ${seed} waiting for walk-forward run dir (seed ${base} )..." >&2
505+ fi
506+ if [[ " ${elapsed} " -ge " ${wait_secs} " ]]; then
507+ echo " [ERROR] Seed ${seed} timed out after ${wait_secs} s waiting for walk-forward run (seed ${base} )" >&2
508+ return 2
509+ fi
510+ sleep " ${interval} "
511+ elapsed=$(( elapsed + interval))
512+ done
490513
491- run_dir=$( find_latest_walk_forward_run_dir " ${crop} " " ${country} " " ${model_slug} " )
492514 if [[ -n " ${run_dir} " && -d " ${run_dir} " ]]; then
493515 local -a existing=()
494516 mapfile -t existing < <( discover_run_seeds_py " ${run_dir} " )
@@ -500,9 +522,6 @@ plan_walk_forward_single_seed() {
500522 fi
501523 done
502524 WF_RUN_DIR=" $( cd " ${run_dir} " && pwd) "
503- elif [[ " ${seed} " != " ${base} " ]]; then
504- echo " [ERROR] Seed ${seed} requires existing walk-forward run (run seed ${base} first)" >&2
505- return 2
506525 else
507526 WF_RUN_DIR=" "
508527 fi
0 commit comments