77import shlex
88import subprocess
99import sys
10+ import time
1011from dataclasses import dataclass
1112from datetime import datetime , timezone
1213from pathlib import Path
@@ -414,6 +415,14 @@ def main() -> None:
414415 run_stamp = datetime .now (timezone .utc ).strftime ("%Y%m%dT%H%M%SZ" )
415416 logs_dir = _reports_dir () / "run_logs" / run_stamp
416417 workdir = _analysis_root ().parent
418+ pipeline_start = time .time ()
419+ total_steps = len (steps )
420+
421+ print ("Pipeline run starting." )
422+ print (f" Config: { config_path } " )
423+ print (f" Working directory: { workdir } " )
424+ print (f" Dry run: { bool (args .dry_run )} " )
425+ print (f" Planned steps: { total_steps } " )
417426
418427 manifest : dict [str , Any ] = {
419428 "pipeline_started_utc" : _utc_now (),
@@ -433,12 +442,19 @@ def main() -> None:
433442 }
434443
435444 try :
436- for step in steps :
437- print (f"[{ step .stage } ] { step .name } " )
445+ for step_index , step in enumerate (steps , start = 1 ):
446+ step_start = time .time ()
447+ print (f"[{ step_index } /{ total_steps } ] [{ step .stage } ] { step .name } " )
438448 print (" " + " " .join (shlex .quote (part ) for part in step .command ))
439449 step_result = _run_step (step = step , workdir = workdir , logs_dir = logs_dir , dry_run = args .dry_run )
440450 manifest ["steps" ].append (step_result )
451+ elapsed_s = time .time () - step_start
452+ print (f" Status: { step_result ['status' ]} (elapsed={ elapsed_s :.1f} s)" )
441453 if step_result ["return_code" ] != 0 :
454+ if step_result .get ("stdout_log" ):
455+ print (f" stdout log: { step_result ['stdout_log' ]} " )
456+ if step_result .get ("stderr_log" ):
457+ print (f" stderr log: { step_result ['stderr_log' ]} " )
442458 raise RuntimeError (f"Step failed: { step .name } (return_code={ step_result ['return_code' ]} )" )
443459 manifest ["status" ] = "dry_run" if args .dry_run else "success"
444460 except Exception as exc : # noqa: BLE001
@@ -449,6 +465,8 @@ def main() -> None:
449465 manifest ["pipeline_finished_utc" ] = _utc_now ()
450466 manifest_out .parent .mkdir (parents = True , exist_ok = True )
451467 manifest_out .write_text (json .dumps (manifest , indent = 2 ) + "\n " , encoding = "utf-8" )
468+ print (f"Pipeline status: { manifest ['status' ]} " )
469+ print (f"Pipeline elapsed seconds: { time .time () - pipeline_start :.1f} " )
452470 print (f"Run manifest: { manifest_out } " )
453471
454472
0 commit comments