Blazing iconBlazing
Coming SoonDev Preview

This content is part of an upcoming preview program. Request early access

Complete guide to building async pipelines with Blazing Flow

Learn how to build resilient, scalable async pipelines with Blazing Flow.

What is Blazing Flow?

Blazing Flow is a distributed task queue and pipeline orchestration engine that makes it easy to build complex, resilient data workflows. It's built on Redis and provides a simple Python API for defining asynchronous pipelines.

Key Features

  • 🧭 Declarative Pipelines - Define workflows using simple Python decorators
  • ⚡ Automatic Recovery - Jobs automatically resume after interruptions
  • 🔄 Dynamic Optimization - Worker mix automatically adjusts to workload
  • 🔌 Connection Pooling - Long-lived database and SSH connections
  • 📊 Deep Observability - Real-time metrics and execution history
  • ⚙️ Flexible Workers - Mix async and blocking workers for optimal performance

When to Use Blazing Flow

Blazing Flow excels at:

✅ Complex Workflows

Multi-stage pipelines with branching logic and conditional execution

✅ Stateful Processing

Workflows that need checkpointing and partial recovery

✅ Mixed Workloads

Combination of I/O-bound and CPU-intensive tasks

✅ Long-Running Jobs

Pipelines that run for hours or days with automatic recovery

Quick Example

Here's a simple data processing pipeline:

Python

Core Concepts

Workflows

Workflows are the entry points to your pipelines. They orchestrate the flow of data through multiple steps.

Python

Steps

Steps are individual processing units. They can optionally receive services to access shared business logic.

Python

Services

Services encapsulate your business logic and can be shared across steps.

Python

Architecture

Blazing Flow uses a hierarchical architecture:

Plain Text

Components

  • Foreman: Manages workers on each machine, optimizes worker mix
  • Workers: Execute tasks from workflows and steps
    • Async Workers: Event-loop based, best for I/O operations
    • Blocking Workers: Thread-based, best for CPU-intensive tasks

Worker Types

Async Workers

Best for I/O-bound operations:

  • API calls
  • Database queries
  • File I/O
  • Network operations
Python

Blocking Workers

Best for CPU-intensive operations:

  • Data processing
  • Image/video processing
  • Cryptographic operations
  • Heavy computations
Python

Dynamic Worker Optimization

The Foreman automatically adjusts the worker mix based on queue metrics:

  • Monitors queue depth and age
  • Calculates urgency scores
  • Increases/decreases async or blocking workers
  • Uses hysteresis to prevent thrashing

You can configure optimization:

Python

State Management

All operations are durably recorded in Redis:

  • Units: Represent workflow executions
  • Operations: Represent step calls
  • Results: Final outputs and intermediate data

This enables:

  • Automatic recovery after failures
  • Audit trails for compliance
  • Performance analysis
  • Debugging with breadcrumbs

Synchronous API

Note: The sync API (SyncBlazing) is designed for learning and prototyping. For production workloads, we strongly recommend using the async Blazing class which provides better performance, proper resource management, and full support for concurrent operations.

Blazing Flow provides a synchronous API for users who are learning or want a simpler getting-started experience.

Option 1: SyncBlazing Class (For Learning/Prototyping)

The simplest sync experience - no async/await anywhere:

Python

Option 2: Sync Helper Methods

If you have existing async code but need sync execution in some places:

Python

When to Use Each API

| Use Case | API | Notes | |----------|-----|-------| | Production workloads | Blazing (async) | ⭐ Recommended - best performance | | FastAPI / async frameworks | Blazing (async) | Native async integration | | Learning Blazing Flow | SyncBlazing | Simpler to understand | | Prototyping | SyncBlazing | Quick iteration | | Jupyter notebooks | SyncBlazing | No asyncio hassle | | Django / Flask (learning) | SyncBlazing | Then migrate to async | | Django / Flask (production) | Blazing with sync helpers | Async inside sync views |

Error Handling

Blazing Flow provides multiple levels of error handling:

Python

Monitoring

Built-in monitoring tools:

btop - Real-time Dashboard

Bash

Shows:

  • Queue depths
  • Worker states
  • Throughput metrics
  • Error rates

Foreman Charts

Bash

Visualizes:

  • Worker mix over time
  • Queue trends
  • Optimization decisions

Next Steps