Pipeline Step Exclusion
This guide will walk you through implementing step exclusion in your AI pipelines to selectively disable specific steps or branches during execution. We'll explore how step exclusion can help you create flexible, configurable pipelines that can adapt to different scenarios without requiring separate pipeline definitions.
Important Note: The pipeline components used in this tutorial (DocumentExtractor, SentimentAnalyzer, etc.) are simplified examples for demonstration purposes. In practice, you would replace these with your actual component implementations. This guide focuses on step exclusion patterns rather than component implementation details.
Installation
# you can use a Conda environment
pip install --extra-index-url "https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-pipeline gllm-rag gllm-core gllm-generation gllm-inference gllm-retrieval gllm-misc gllm-datastore# you can use a Conda environment
pip install --extra-index-url "https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-pipeline gllm-rag gllm-core gllm-generation gllm-inference gllm-retrieval gllm-misc gllm-datastore# you can use a Conda environment
FOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-pipeline gllm-rag gllm-core gllm-generation gllm-inference gllm-retrieval gllm-misc gllm-datastoreProject Setup
Project Structure
Create your project structure for parallel pipeline implementation:
<your-project>/
├── modules/
│ └── [your actual components]
└── pipeline.py # 👈 Pipeline with parallel stepsUnderstanding Step Exclusion
Step exclusion is a powerful feature that allows you to selectively disable specific steps or branches within your pipeline during execution. This is particularly useful for:
A/B Testing: Compare different processing paths without creating separate pipelines
Debugging: Temporarily disable problematic steps to isolate issues
Feature Flags: Enable/disable features dynamically based on configuration
Performance Optimization: Skip expensive operations when not needed
Conditional Processing: Adapt pipeline behavior based on runtime conditions
The exclusion system uses dot-notation paths to identify specific steps or branches:
Simple Steps:
"step_name"- Excludes the entire stepParallel Branches:
"parallel_step.branch_name"- Excludes a specific parallel branchConditional Branches:
"conditional_step.true"or"conditional_step.false"- Excludes a conditional branchNested Steps:
"parent_step.child_step"- Excludes a child step within a composite step
Example
Basic Use
Let's start with a basic document processing pipeline:
Step Exclusion for Conditional Step
For conditional processing, you can exclude entire branches:
Step Exclusion for Complex Pipeline Structures
For complex pipeline structures, you can exclude deeply nested steps:
Dynamic Pipeline using Step Exclusion
You can dynamically manage exclusions based on runtime conditions:
Step Exclusion Lifecycle
You can manage exclusion state throughout the pipeline lifecycle:
Congratulations! You've successfully learned how to implement step exclusion in your AI pipelines. By strategically applying step exclusion, you can create flexible, configurable pipelines that adapt to different scenarios without requiring separate pipeline definitions. Your pipelines will now support dynamic behavior modification, better debugging capabilities, and improved maintainability through selective step execution.
Last updated