This commit is contained in:
2026-03-21 15:12:52 -07:00
parent 11384266e3
commit d9a6b1bfb4
6 changed files with 512 additions and 21 deletions

View File

@@ -39,6 +39,16 @@ def get_live_progress() -> Any:
return state.live_progress
def set_progress_event_callback(callback: Any) -> None:
state = _get_pipeline_state()
state.progress_event_callback = callback
def get_progress_event_callback() -> Any:
state = _get_pipeline_state()
return state.progress_event_callback
@contextmanager
def suspend_live_progress():
"""Temporarily pause Live progress rendering.
@@ -104,6 +114,7 @@ class PipelineState:
pipeline_stop: Optional[Dict[str, Any]] = None
live_progress: Any = None
last_execution_result: Dict[str, Any] = field(default_factory=dict)
progress_event_callback: Any = None
def reset(self) -> None:
self.current_context = None
@@ -130,6 +141,7 @@ class PipelineState:
self.pipeline_stop = None
self.live_progress = None
self.last_execution_result = {}
self.progress_event_callback = None
# ContextVar for per-run state (prototype)
@@ -2431,6 +2443,10 @@ class PipelineExecutor:
if hasattr(_pipeline_ctx, "set_live_progress"):
_pipeline_ctx.set_live_progress(progress_ui)
if hasattr(_pipeline_ctx, "get_progress_event_callback"):
progress_cb = _pipeline_ctx.get_progress_event_callback()
if callable(progress_cb) and hasattr(progress_ui, "set_event_callback"):
progress_ui.set_event_callback(progress_cb)
except Exception:
logger.exception("Failed to register PipelineLiveProgress with pipeline context")
pipe_index_by_stage = {