Skip to content

Commit ee16d22

Browse files
authored
Stop live execution after exception. (#640)
1 parent 0ca74e4 commit ee16d22

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

docs/source/changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
55
releases are available on [PyPI](https://pypi.org/project/pytask) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask).
77

8+
## 0.5.2 - 2024-09-15
9+
10+
- {pull}`640` stops the live display when an exception happened during the execution.
11+
812
## 0.5.1 - 2024-07-20
913

1014
- {pull}`616` and {pull}`632` redesign the guide on "Scaling Tasks".

src/_pytask/live.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ class LiveExecution:
174174
def pytask_execute_build(self) -> Generator[None, None, None]:
175175
"""Wrap the execution with the live manager and yield a table at the end."""
176176
self.live_manager.start()
177-
result = yield
178-
self.live_manager.stop(transient=True)
179-
table = self._generate_table(
180-
reduce_table=False, sort_table=self.sort_final_table, add_caption=False
181-
)
182-
if table is not None:
183-
console.print(table)
184-
return result
177+
try:
178+
return (yield)
179+
finally:
180+
self.live_manager.stop(transient=True)
181+
table = self._generate_table(
182+
reduce_table=False, sort_table=self.sort_final_table, add_caption=False
183+
)
184+
if table is not None:
185+
console.print(table)
185186

186187
@hookimpl(tryfirst=True)
187188
def pytask_execute_task_log_start(self, task: PTask) -> bool:

0 commit comments

Comments
 (0)