@@ -94,12 +94,22 @@ class LiveManager:
94
94
"""A class for live displays during a session.
95
95
96
96
This class allows to display live information during a session and handles the
97
- interaction with the :class:`_pytask.debugging.PytaskPDB` and
98
- :class:`_pytask.capture.CaptureManager`.
97
+ interaction with the :class:`_pytask.debugging.PytaskPDB`.
98
+
99
+ The renderable is not updated automatically for two reasons.
100
+
101
+ 1. Usually, the duration of tasks is highly heterogeneous and there are probably not
102
+ many tasks which last much less than a second. Therefore, updating the renderable
103
+ automatically by a fixed time interval seems unnecessary.
104
+
105
+ 2. To update the renderable automatically a thread is started which pushes the
106
+ updates. When a task is run simultaneously and capturing is activated, all
107
+ updates will be captured and added to the stdout of the task instead of printed
108
+ to the terminal.
99
109
100
110
"""
101
111
102
- _live = Live (renderable = None , console = console , auto_refresh = True )
112
+ _live = Live (renderable = None , console = console , auto_refresh = False )
103
113
104
114
def start (self ) -> None :
105
115
self ._live .start ()
@@ -121,6 +131,7 @@ def resume(self) -> None:
121
131
122
132
def update (self , * args : Any , ** kwargs : Any ) -> None :
123
133
self ._live .update (* args , ** kwargs )
134
+ self ._live .refresh ()
124
135
125
136
@property
126
137
def is_started (self ) -> None :
@@ -144,8 +155,8 @@ def pytask_execute_build(self) -> Generator[None, None, None]:
144
155
end."""
145
156
self ._live_manager .start ()
146
157
yield
147
- self ._update_table ( reduce_table = False , sort_table = True )
148
- self ._live_manager . stop ( transient = False )
158
+ self ._live_manager . stop ( transient = True )
159
+ console . print ( self ._generate_table ( reduce_table = False , sort_table = True ) )
149
160
150
161
@hookimpl (tryfirst = True )
151
162
def pytask_execute_task_log_start (self , task : MetaTask ) -> bool :
@@ -264,7 +275,6 @@ def pytask_collect_file_log(self, reports: List[CollectionReport]) -> None:
264
275
265
276
@hookimpl (hookwrapper = True )
266
277
def pytask_collect_log (self ) -> Generator [None , None , None ]:
267
- self ._live_manager .update (None )
268
278
self ._live_manager .stop (transient = True )
269
279
yield
270
280
0 commit comments