This commit is contained in:
2026-01-20 00:31:44 -08:00
parent fcab85455d
commit 1f65f9de2a
5 changed files with 104 additions and 21 deletions

View File

@@ -1376,16 +1376,18 @@ class PipelineLiveProgress:
total = self._pipe_totals[pipe_index]
active = self._subtask_active_index[pipe_index]
# If a stage emits more than expected, extend totals dynamically.
if done >= total:
total = done + 1
self._pipe_totals[pipe_index] = total
pipe_task = self._pipe_tasks[pipe_index]
pipe_progress.update(pipe_task, total=total)
# If a stage emits more than expected, or if we have no subtasks yet, extend dynamically.
if (done >= total) or (not self._subtask_ids[pipe_index]):
if done >= total:
total = done + 1
self._pipe_totals[pipe_index] = total
pipe_task = self._pipe_tasks[pipe_index]
pipe_progress.update(pipe_task, total=total)
# Add a placeholder subtask.
# Add a placeholder/next subtask.
label = _pipeline_progress_item_label(emitted)
sub_id = subtasks.add_task(
f"{self._pipe_labels[pipe_index]}: {_pipeline_progress_item_label(emitted)}"
f"{self._pipe_labels[pipe_index]}: {label}"
)
subtasks.stop_task(sub_id)
subtasks.update(sub_id, visible=False)
@@ -1457,6 +1459,9 @@ class PipelineLiveProgress:
assert overall is not None
total = self._pipe_totals[pipe_index]
if total < 1:
total = 1
self._pipe_totals[pipe_index] = total
done = self._pipe_done[pipe_index]
# Ensure the pipe bar finishes even if cmdlet didnt emit per item.
@@ -1499,6 +1504,16 @@ class PipelineLiveProgress:
self._update_overall()
def complete_all_pipes(self) -> None:
"""Mark every configured pipe as finished so UI bars reach 100%."""
if not self._enabled:
return
for idx in range(len(self._pipe_labels)):
try:
self.finish_pipe(idx)
except Exception:
pass
class PipelineStageContext:
"""Context information for the current pipeline stage."""