nirs4all.pipeline.trace.extractor module
Trace-Based Extractor - Extract minimal pipeline from execution trace.
This module provides the TraceBasedExtractor class which extracts the minimal set of pipeline steps needed to replay a prediction from an ExecutionTrace.
The extractor is controller-agnostic: it uses the recorded trace information to identify which steps are needed, without encoding knowledge of specific controller types. This enables the same infrastructure to work with any controller (existing or custom).
- Key Features:
Extracts minimal pipeline (only steps needed for prediction)
Builds artifact map for step-based artifact injection
Creates dependency graph for step execution order
Supports branch-aware extraction for multi-branch pipelines
- Usage:
>>> from nirs4all.pipeline.trace import TraceBasedExtractor, ExecutionTrace >>> >>> # Load trace from manifest >>> trace = ExecutionTrace.from_dict(trace_dict) >>> >>> # Extract minimal pipeline >>> extractor = TraceBasedExtractor() >>> minimal = extractor.extract(trace, full_pipeline_steps) >>> >>> # Use minimal pipeline for prediction >>> for step_info in minimal.steps: ... artifacts = minimal.get_artifacts_for_step(step_info.step_index) ... # Execute step with artifacts