Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Add complete Pipeline DSL system including:
- Rust backend (zclaw-pipeline crate) with parser, executor, and state management
- Frontend components: PipelinesPanel, PipelineResultPreview, ClassroomPreviewer
- Pipeline recommender for Agent conversation integration
- 5 pipeline templates: education, marketing, legal, research, productivity
- Documentation for Pipeline DSL architecture
Pipeline DSL enables declarative workflow definitions with:
- YAML-based configuration
- Expression resolution (${inputs.topic}, ${steps.step1.output})
- LLM integration, parallel execution, file export
- Agent smart recommendations in conversations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
791 B
Rust
34 lines
791 B
Rust
//! Parallel execution action
|
|
|
|
use futures::stream::{self, StreamExt};
|
|
use serde_json::Value;
|
|
|
|
use super::ActionError;
|
|
|
|
/// Execute steps in parallel
|
|
pub async fn execute_parallel<F, Fut>(
|
|
items: &[Value],
|
|
max_workers: usize,
|
|
executor: F,
|
|
) -> Result<Vec<Value>, ActionError>
|
|
where
|
|
F: Fn(Value, usize) -> Fut,
|
|
Fut: std::future::Future<Output = Result<Value, ActionError>>,
|
|
{
|
|
let results: Vec<Result<Value, ActionError>> = stream::iter(items.iter().enumerate())
|
|
.map(|(index, item)| {
|
|
let item = item.clone();
|
|
executor(item, index)
|
|
})
|
|
.buffer_unordered(max_workers)
|
|
.collect()
|
|
.await;
|
|
|
|
let mut outputs = Vec::new();
|
|
for result in results {
|
|
outputs.push(result?);
|
|
}
|
|
|
|
Ok(outputs)
|
|
}
|