1515# Behavior:
1616# - Recursively finds *_scenario.yml / *_scenario.yaml files under <root_dir>.
1717# - For each scenario, runs in its directory:
18- # ngraph inspect <file> → writes notebook/artifacts (tool-defined)
19- # ngraph run <file> → writes results JSON (tool-defined)
20- # ngraph report --html <file> → writes HTML report (tool-defined)
18+ # ngraph inspect -o <dir> <file>
19+ # ngraph run -o <dir> <file>
20+ # ngraph report -o <dir> <results.json> --html --notebook <path>
2121# - Logs for each step are saved next to the scenario file:
2222# <stem>.inspect.log, <stem>.run.log, <stem>.report.log
2323# - If --force is not set and cached artifacts are found (results JSON + HTML),
6363}
6464
6565ARGS=()
66- while [[ $# > 0 ]]; do
66+ while [[ $# -gt 0 ]]; do
6767 case " $1 " in
6868 --include)
6969 shift || true
@@ -146,8 +146,8 @@ passes_filters() {
146146
147147has_cached () {
148148 # Cached if expected results and HTML report exist
149- local dir=" $1 " ; local stem =" $2 "
150- if [[ -f " $dir /$stem .json" && -f " $dir /$stem .html" ]]; then
149+ local dir=" $1 " ; local results_prefix =" $2 "
150+ if [[ -f " $dir /$results_prefix .json" && -f " $dir /$results_prefix .html" ]]; then
151151 return 0
152152 fi
153153 return 1
@@ -176,6 +176,10 @@ while IFS= read -r -d '' scn; do
176176 scn_dir=$( cd " $( dirname -- " $scn " ) " && pwd)
177177 scn_base_noext=${scn_name% .* }
178178 scn_stem=${scn_base_noext}
179+ results_prefix=" $scn_stem .results"
180+ results_json=" $scn_dir /$results_prefix .json"
181+ html_path=" $scn_dir /$results_prefix .html"
182+ ipynb_path=" $scn_dir /$results_prefix .ipynb"
179183
180184 echo " ➡️ Scenario: $scn_name "
181185 echo " 📁 Dir: $scn_dir "
@@ -184,31 +188,26 @@ while IFS= read -r -d '' scn; do
184188 log_run=" $scn_dir /$scn_stem .run.log"
185189 log_rep=" $scn_dir /$scn_stem .report.log"
186190
187- if [[ " $FORCE " == " false" ]] && has_cached " $scn_dir " " $scn_stem " ; then
191+ if [[ " $FORCE " == " false" ]] && has_cached " $scn_dir " " $results_prefix " ; then
188192 echo " ⏭️ Cached: results + report found, skipping"
189193 ins_status=" ⏭️ cached" ; run_status=" ⏭️ cached" ; rep_status=" ⏭️ cached"
190194 ins_cached=$(( ins_cached + 1 ))
191195 run_cached=$(( run_cached + 1 ))
192196 rep_cached=$(( rep_cached + 1 ))
193197 else
194198 # Inspect
195- (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " inspect " $scn_abs " ) 2>&1 | tee " $log_ins "
199+ (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " inspect -o " $scn_dir " " $scn_abs " ) 2>&1 | tee " $log_ins "
196200 ins_ec=${PIPESTATUS[0]}
197201 if [[ $ins_ec -eq 0 ]]; then
198202 ins_status=" ✅" ; ins_ok=$(( ins_ok + 1 ))
199203 # Run
200- (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " run " $scn_abs " ) 2>&1 | tee " $log_run "
204+ (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " run -o " $scn_dir " -r " $results_json " " $scn_abs " ) 2>&1 | tee " $log_run "
201205 run_ec=${PIPESTATUS[0]}
202206 if [[ $run_ec -eq 0 ]]; then
203207 run_status=" ✅" ; run_ok=$(( run_ok + 1 ))
204208 # Report
205- results_json=" $scn_dir /$scn_stem .json"
206- # If the default name was not used, fallback to results.json
207- if [[ ! -f " $results_json " && -f " $scn_dir /results.json" ]]; then
208- results_json=" $scn_dir /results.json"
209- fi
210- # Generate both HTML and Notebook deterministically named after the scenario stem
211- (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " report " $results_json " --html " $scn_dir /$scn_stem .html" --notebook " $scn_dir /$scn_stem .ipynb" ) 2>&1 | tee " $log_rep "
209+ # Generate both HTML and Notebook under the scenario directory using the results-derived prefix
210+ (cd " $scn_dir " && " ${NGRAPH_INVOKE[@]} " report -o " $scn_dir " " $results_json " --html " $html_path " --notebook " $ipynb_path " ) 2>&1 | tee " $log_rep "
212211 rep_ec=${PIPESTATUS[0]}
213212 if [[ $rep_ec -eq 0 ]]; then
214213 rep_status=" ✅" ; rep_ok=$(( rep_ok + 1 ))
0 commit comments