diff --git a/docs/source/changes.md b/docs/source/changes.md index a16f37f35..342675960 100644 --- a/docs/source/changes.md +++ b/docs/source/changes.md @@ -5,6 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/) releases are available on [PyPI](https://pypi.org/project/pytask) and [Anaconda.org](https://anaconda.org/conda-forge/pytask). +## 0.5.2 - 2024-09-15 + +- {pull}`640` stops the live display when an exception happened during the execution. + ## 0.5.1 - 2024-07-20 - {pull}`616` and {pull}`632` redesign the guide on "Scaling Tasks". diff --git a/src/_pytask/live.py b/src/_pytask/live.py index ab6db556a..6ea7c308a 100644 --- a/src/_pytask/live.py +++ b/src/_pytask/live.py @@ -174,14 +174,15 @@ class LiveExecution: def pytask_execute_build(self) -> Generator[None, None, None]: """Wrap the execution with the live manager and yield a table at the end.""" self.live_manager.start() - result = yield - self.live_manager.stop(transient=True) - table = self._generate_table( - reduce_table=False, sort_table=self.sort_final_table, add_caption=False - ) - if table is not None: - console.print(table) - return result + try: + return (yield) + finally: + self.live_manager.stop(transient=True) + table = self._generate_table( + reduce_table=False, sort_table=self.sort_final_table, add_caption=False + ) + if table is not None: + console.print(table) @hookimpl(tryfirst=True) def pytask_execute_task_log_start(self, task: PTask) -> bool: