Scenario 1: Basic Sequential Processing Demonstrates: MaxConcurrency=0 for sequential execution
(ctx context.Context)
| 173 | // Scenario 1: Basic Sequential Processing |
| 174 | // Demonstrates: MaxConcurrency=0 for sequential execution |
| 175 | func runBasicSequential(ctx context.Context) { |
| 176 | docs := createSampleDocuments(3) |
| 177 | workflow := createSimpleReviewWorkflow() |
| 178 | |
| 179 | batchNode := batch.NewBatchNode(&batch.NodeConfig[ReviewRequest, ReviewResult]{ |
| 180 | Name: "SequentialReviewer", |
| 181 | InnerTask: workflow, |
| 182 | MaxConcurrency: 0, // Sequential: process one at a time |
| 183 | }) |
| 184 | |
| 185 | start := time.Now() |
| 186 | results, err := batchNode.Invoke(ctx, docs) |
| 187 | elapsed := time.Since(start) |
| 188 | |
| 189 | if err != nil { |
| 190 | fmt.Printf("Error: %v\n", err) |
| 191 | return |
| 192 | } |
| 193 | |
| 194 | fmt.Printf("Processed %d documents sequentially in %v\n", len(results), elapsed) |
| 195 | for _, r := range results { |
| 196 | fmt.Printf(" - %s: approved=%v, score=%.2f\n", r.DocumentID, r.Approved, r.Score) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | // Scenario 2: Concurrent Processing |
| 201 | // Demonstrates: MaxConcurrency>0 for parallel execution with limit |
no test coverage detected