PipelineStep — wrap run() with try/catch and report failing folder path
Problem
Currently PipelineStep.run() has no error handling. When a step fails mid-way through iterating over folders, the pipeline crashes immediately with no information about which folder caused the failure.
Proposed Solution
Split run() into two methods:
- Rename the existing
run() abstract method to _run() — subclasses implement this
- Add a new
run() as a wrapper that handles errors and logging
from typing import final
class PipelineStep(ABC):
def run(self) -> bool:
"""Public entry point. Wraps _run() with error handling."""
print(f"Starting Step: {self.name} ⏳")
try:
self._run()
print(f"Finished Step: {self.name} ✅")
return True
except Exception as e:
print(f"Failed Step: {self.name} ❌ — {e}")
raise
@abstractmethod
def _run(self) -> None:
"""Actual step logic. Subclasses implement this."""
Inside each subclass _run(), the per-folder loop should catch and re-raise with the folder path:
def _run(self) -> None:
for input_folder, output_folder in zip(self.input_folders, self.output_folders):
try:
# ... step logic ...
except Exception as e:
raise RuntimeError(f"Failed at folder: {input_folder}") from e
Expected Output
Failed Step: BuildDigitalSurfaceModel ❌ — Failed at folder: D:/data/mjolnir/re112o_250610/02_processing
Tasks
Out of Scope
How the pipeline orchestrator handles step failures (skip vs. abort, retry, reporting) is not part of this issue.
PipelineStep— wraprun()with try/catch and report failing folder pathProblem
Currently
PipelineStep.run()has no error handling. When a step fails mid-way through iterating over folders, the pipeline crashes immediately with no information about which folder caused the failure.Proposed Solution
Split
run()into two methods:run()abstract method to_run()— subclasses implement thisrun()as a wrapper that handles errors and loggingInside each subclass
_run(), the per-folder loop should catch and re-raise with the folder path:Expected Output
Tasks
run()→_run()inPipelineStepbase classrun()wrapper with try/catch to base classrun()→_run()and add per-folder try/catchOut of Scope
How the pipeline orchestrator handles step failures (skip vs. abort, retry, reporting) is not part of this issue.