Skip to content

Commit

Permalink
emit higher-quality error message on node failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jan 2, 2025
1 parent 0b55981 commit cf7042b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lenskit/lenskit/pipeline/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def run(self, node: Node[Any], *, required: bool = True) -> Any:
"""
Run the pipleline to obtain the results of a node.
"""
log = _log.bind(node=node.name)
status = self.status[node.name]
if status == "finished":
return self.state[node.name]
Expand All @@ -62,13 +63,13 @@ def run(self, node: Node[Any], *, required: bool = True) -> Any:
elif status == "failed": # pragma: nocover
raise RuntimeError(f"{node} previously failed")

trace(self.log, "processing node", node=node.name)
trace(log, "processing node")
self.status[node.name] = "in-progress"
try:
self._run_node(node, required)
self.status[node.name] = "finished"
except Exception as e:
_log.error("node %s failed with error %s", node, e)
log.error("failed to run node", exc_info=e)
self.status[node.name] = "failed"
raise e

Expand Down

0 comments on commit cf7042b

Please sign in to comment.