@@ -70,11 +70,14 @@ def pytask_post_parse(config: dict[str, Any]) -> None:
7070 n_entries_in_table = config ["n_entries_in_table" ],
7171 verbose = config ["verbose" ],
7272 editor_url_scheme = config ["editor_url_scheme" ],
73+ render_immediately = console .is_interactive ,
7374 sort_final_table = config ["sort_table" ],
7475 )
7576 config ["pm" ].register (live_execution , "live_execution" )
7677
77- live_collection = LiveCollection (live_manager = live_manager )
78+ live_collection = LiveCollection (
79+ live_manager = live_manager , render_immediately = console .is_interactive
80+ )
7881 config ["pm" ].register (live_collection , "live_collection" )
7982
8083
@@ -187,6 +190,7 @@ class LiveExecution:
187190 editor_url_scheme : str
188191 initial_status : TaskExecutionStatus = TaskExecutionStatus .RUNNING
189192 sort_final_table : bool = False
193+ render_immediately : bool = True
190194 n_tasks : int | str = "x"
191195 _reports : list [_ReportEntry ] = field (default_factory = list )
192196 _running_tasks : dict [str , _TaskEntry ] = field (default_factory = dict )
@@ -306,12 +310,14 @@ def add_task(self, new_running_task: PTask, status: TaskExecutionStatus) -> None
306310 self ._running_tasks [new_running_task .signature ] = _TaskEntry (
307311 task = new_running_task , status = status
308312 )
309- self ._update_table ()
313+ if self .render_immediately :
314+ self ._update_table ()
310315
311316 def update_task (self , signature : str , status : TaskExecutionStatus ) -> None :
312317 """Update the status of a running task."""
313318 self ._running_tasks [signature ].status = status
314- self ._update_table ()
319+ if self .render_immediately :
320+ self ._update_table ()
315321
316322 def update_report (self , new_report : ExecutionReport ) -> None :
317323 """Update the status of a running task by adding its report."""
@@ -323,14 +329,16 @@ def update_report(self, new_report: ExecutionReport) -> None:
323329 task = new_report .task ,
324330 )
325331 )
326- self ._update_table ()
332+ if self .render_immediately :
333+ self ._update_table ()
327334
328335
329336@dataclass (eq = False , kw_only = True )
330337class LiveCollection :
331338 """A class for managing the live status during the collection."""
332339
333340 live_manager : LiveManager
341+ render_immediately : bool = True
334342 _n_collected_tasks : int = 0
335343 _n_errors : int = 0
336344
@@ -362,6 +370,8 @@ def _update_statistics(self, reports: list[CollectionReport]) -> None:
362370
363371 def _update_status (self ) -> None :
364372 """Update the status."""
373+ if not self .render_immediately :
374+ return
365375 status = self ._generate_status ()
366376 self .live_manager .update (status )
367377
0 commit comments