Event-driven workflow orchestration framework with flexible connection, state management, and workflow orchestration capabilities
Project description
Routilux โก
Routilux is a powerful, event-driven workflow orchestration framework that makes building complex data pipelines and workflows effortless. With its intuitive API and flexible architecture, you can create sophisticated workflows in minutes, not hours.
โจ Why Routilux?
- ๐ Event-Driven Architecture: Build reactive workflows that respond to events naturally
- ๐ Flexible Connections: Many-to-many relationships between routines with intelligent data routing
- ๐ Built-in State Management: Track execution state, performance metrics, and history out of the box
- ๐ก๏ธ Robust Error Handling: Multiple strategies (STOP, CONTINUE, RETRY, SKIP) with automatic recovery
- โก Concurrent Execution: Automatic parallelization for I/O-bound operations
- ๐พ Persistence & Recovery: Save and resume workflows from any point
- ๐ฏ Production Ready: Comprehensive error handling, execution tracking, and monitoring
๐ฏ Perfect For
- Data Pipelines: ETL processes, data transformation workflows
- API Orchestration: Coordinating multiple API calls with complex dependencies
- Event Processing: Real-time event streams and reactive systems
- Workflow Automation: Business process automation and task scheduling
- Microservices Coordination: Managing interactions between services
- LLM Agent Workflows: Complex AI agent orchestration and chaining
๐ฆ Installation
Quick Install (Recommended)
pip install routilux
That's it! You're ready to go.
Development Install
For development with all dependencies:
pip install -e ".[dev]"
# Or using Makefile
make dev-install
๐ Quick Start
Create Your First Workflow in 3 Steps
Step 1: Define a Routine
from routilux import Routine
class DataProcessor(Routine):
def __init__(self):
super().__init__()
# Define input slot
self.input_slot = self.define_slot("input", handler=self.process_data)
# Define output event
self.output_event = self.define_event("output", ["result"])
def process_data(self, data: str):
result = f"Processed: {data}"
self._stats["processed_count"] = self._stats.get("processed_count", 0) + 1
self.emit("output", result=result)
Step 2: Create and Connect a Flow
from routilux import Flow
flow = Flow(flow_id="my_workflow")
processor1 = DataProcessor()
processor2 = DataProcessor()
id1 = flow.add_routine(processor1, "processor1")
id2 = flow.add_routine(processor2, "processor2")
# Connect: processor1's output โ processor2's input
flow.connect(id1, "output", id2, "input")
Step 3: Execute
job_state = flow.execute(id1, entry_params={"data": "Hello, Routilux!"})
print(job_state.status) # "completed"
print(processor1.stats()) # {"processed_count": 1}
๐ Done! You've created your first workflow.
๐ก Key Features
๐ Event-Driven Execution
Routines communicate through events and slots, creating a natural, reactive flow:
# Multiple routines can listen to the same event
flow.connect(processor1, "output", processor2, "input")
flow.connect(processor1, "output", processor3, "input") # Fan-out
# Multiple events can feed into the same slot
flow.connect(processor1, "output", aggregator, "input")
flow.connect(processor2, "output", aggregator, "input") # Fan-in
๐๏ธ Flexible State Management
Track everything automatically:
# Access routine state
stats = routine.stats() # {"processed_count": 42, "errors": 0}
# Track execution history
history = job_state.get_execution_history()
# Performance metrics
perf = flow.execution_tracker.get_routine_performance("processor1")
๐ก๏ธ Built-in Error Handling
Choose the right strategy for your use case:
from routilux import ErrorHandler, ErrorStrategy
# Stop on error (default)
flow.set_error_handler(ErrorHandler(ErrorStrategy.STOP))
# Continue and log errors
flow.set_error_handler(ErrorHandler(ErrorStrategy.CONTINUE))
# Retry with exponential backoff
flow.set_error_handler(ErrorHandler(
ErrorStrategy.RETRY,
max_retries=3,
retry_delay=1.0,
backoff_multiplier=2.0
))
โก Concurrent Execution
Automatic parallelization for better performance:
# Enable concurrent execution
flow.set_execution_strategy("concurrent", max_workers=4)
# Routines that can run in parallel are automatically executed concurrently
job_state = flow.execute(entry_routine_id)
๐พ Persistence & Recovery
Save and resume workflows:
# Save workflow state
job_state.save("workflow_state.json")
# Later, resume from saved state
saved_state = JobState.load("workflow_state.json")
flow.resume(saved_state)
๐ Documentation
๐ Full documentation available at: routilux.readthedocs.io
Documentation Highlights
- ๐ User Guide: Comprehensive guide covering all features
- ๐ง API Reference: Complete API documentation
- ๐ป Examples: Real-world code examples
- ๐๏ธ Design: Architecture and design principles
Build Documentation Locally
pip install -e ".[docs]"
cd docs && make html
๐ Examples
Check out the examples/ directory for practical examples:
basic_example.py- Your first workflowdata_processing.py- Multi-stage data pipelineconcurrent_flow_demo.py- Parallel executionerror_handling_example.py- Error handling strategiesstate_management_example.py- State tracking and recoverybuiltin_routines_demo.py- Using built-in routines
Run examples:
python examples/basic_example.py
๐งฉ Built-in Routines
Routilux comes with a rich set of built-in routines ready to use:
- Text Processing:
TextClipper,TextRenderer,ResultExtractor - Data Processing:
DataTransformer,DataValidator,DataFlattener - Control Flow:
ConditionalRouterfor dynamic routing - Utilities:
TimeProviderfor timestamps
from routilux.builtin_routines import ConditionalRouter, DataTransformer
# Use built-in routines directly
router = ConditionalRouter()
transformer = DataTransformer()
๐๏ธ Project Structure
routilux/
โโโ routilux/ # Main package
โ โโโ routine.py # Routine base class
โ โโโ flow.py # Flow manager
โ โโโ job_state.py # State management
โ โโโ connection.py # Connection management
โ โโโ event.py # Event class
โ โโโ slot.py # Slot class
โ โโโ error_handler.py # Error handling
โ โโโ execution_tracker.py # Performance tracking
โโโ tests/ # Comprehensive test suite
โโโ examples/ # Usage examples
โโโ docs/ # Sphinx documentation
๐งช Testing
Routilux comes with comprehensive tests:
# Run all tests
make test-all
# Run with coverage
make test-cov
# Run specific test suite
pytest tests/ # Core tests
pytest routilux/builtin_routines/ # Built-in routines tests
๐ค Contributing
We welcome contributions! Here's how you can help:
- Star the project โญ - Show your support
- Report bugs ๐ - Help us improve
- Suggest features ๐ก - Share your ideas
- Submit PRs ๐ง - Contribute code
๐ License
Routilux is licensed under the Apache License 2.0. See LICENSE for details.
๐ Links
- ๐ฆ PyPI: pypi.org/project/routilux
- ๐ Documentation: routilux.readthedocs.io
- ๐ GitHub: github.com/lzjever/routilux
- ๐ง Issues: github.com/lzjever/routilux/issues
โญ Show Your Support
If Routilux helps you build amazing workflows, consider giving it a star on GitHub!
Built with โค๏ธ by the Routilux Team
Making workflow orchestration simple, powerful, and fun.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file routilux-0.8.1.tar.gz.
File metadata
- Download URL: routilux-0.8.1.tar.gz
- Upload date:
- Size: 179.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb21800d1056a179eb7e1787305b413582eb33ea59c9d0fa4dbfbd92c9e02b16
|
|
| MD5 |
7ee739f22559c0e27379c6146d4f3721
|
|
| BLAKE2b-256 |
bcbcc2e994e6aeeda7638b70fef87733145ca352058559718e617f3b1c1e4b79
|
File details
Details for the file routilux-0.8.1-py3-none-any.whl.
File metadata
- Download URL: routilux-0.8.1-py3-none-any.whl
- Upload date:
- Size: 79.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e883185fdada0e5dd0ca5c84f2150418988670b745b0ed60c2317f3c0c300ea9
|
|
| MD5 |
466b57dd5ff3e8f300ffcf04d9f60432
|
|
| BLAKE2b-256 |
4743bb8f9fb8e65ac6644b6858494fd045d89e7d36aefcdbf16b3d3d3dbb73e3
|