Skip to main content

Event-driven workflow orchestration framework with flexible connection, state management, and workflow orchestration capabilities

Project description

Routilux

Event-driven workflow orchestration framework with flexible connection, state management, and workflow orchestration capabilities.

Features

  • Slots and Events Mechanism: Clear distinction between input slots and output events
  • Many-to-Many Connections: Flexible connection relationships between routines
  • State Management: Unified stats() method for tracking routine state
  • Flow Manager: Workflow orchestration, persistence, and recovery
  • JobState Management: Execution state recording and recovery functionality
  • Error Handling: Multiple error handling strategies (STOP, CONTINUE, RETRY, SKIP)
  • Execution Tracking: Comprehensive execution tracking and performance monitoring
  • Serialization Support: Full serialization/deserialization support for persistence

Installation

For Development (Recommended)

# Install package in editable mode with development dependencies
pip install -e ".[dev]"

# Or using Makefile
make dev-install

This installs the package in "editable" mode, meaning:

  • Changes to source code are immediately available
  • No need to reinstall after code changes
  • All imports work correctly without sys.path manipulation

For Production

pip install -e .

Or install from PyPI (when published):

pip install routilux

Or install from a built package:

pip install dist/routilux-*.whl

Quick Start

Creating a Routine

from routilux import Routine

class DataProcessor(Routine):
    def __init__(self):
        super().__init__()
        self.input_slot = self.define_slot("input", handler=self.process_data)
        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)

Creating and Connecting a Flow

from routilux import Flow

flow = Flow(flow_id="my_flow")

processor1 = DataProcessor()
processor2 = DataProcessor()

id1 = flow.add_routine(processor1, "processor1")
id2 = flow.add_routine(processor2, "processor2")

flow.connect(id1, "output", id2, "input")

Executing a Flow

job_state = flow.execute(id1, entry_params={"data": "test"})
print(job_state.status)  # "completed"
print(processor1.stats())  # {"processed_count": 1}

Documentation

Full documentation is available at:

  • Online: Read the Docs (when published)
  • Local: Build with cd docs && make html

Documentation Structure

  • Introduction: Overview and key concepts
  • Installation: Installation instructions
  • Quick Start: Getting started guide
  • User Guide: Detailed usage instructions
    • Working with Routines
    • Working with Flows
    • Connections
    • State Management
    • Error Handling
    • Serialization
  • API Reference: Complete API documentation
  • Examples: Practical code examples
  • Design: Design documentation and architecture
  • Features: Feature overview
  • Testing: Testing information

Examples

See the examples/ directory for practical examples:

  • basic_example.py - Basic routine and flow usage
  • data_processing.py - Multi-stage data processing pipeline
  • error_handling_example.py - Error handling strategies
  • state_management_example.py - State management and tracking

Run examples:

python examples/basic_example.py

Project Structure

routilux/
├── routilux/          # Main package
│   ├── routine.py          # Routine base class
│   ├── flow.py             # Flow manager
│   ├── job_state.py        # JobState management
│   ├── connection.py       # Connection management
│   ├── event.py            # Event class
│   ├── slot.py             # Slot class
│   ├── error_handler.py    # Error handler
│   └── execution_tracker.py # Execution tracker
├── tests/                  # Test cases
├── examples/               # Usage examples
├── docs/                    # Sphinx documentation
└── README.md               # This file

Testing

Run tests:

# All tests
pytest tests/

# With coverage
pytest --cov=routilux --cov-report=html tests/

Development

Building Documentation

pip install -e ".[docs]"
cd docs && make html

Code Formatting

black routilux/
flake8 routilux/

License

Routilux is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

Copyright (c) 2024 Routilux Team

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Links

  • Documentation: See docs/ directory
  • Examples: See examples/ directory
  • Tests: See tests/ directory

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

routilux-0.8.0.tar.gz (176.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

routilux-0.8.0-py3-none-any.whl (83.3 kB view details)

Uploaded Python 3

File details

Details for the file routilux-0.8.0.tar.gz.

File metadata

  • Download URL: routilux-0.8.0.tar.gz
  • Upload date:
  • Size: 176.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for routilux-0.8.0.tar.gz
Algorithm Hash digest
SHA256 7938887e79dc305d376b10eaa3a0f103c9b6c8f6e25c835141ff2778be8e460c
MD5 6f88557fcf89b75e5ef49aa49bb384ea
BLAKE2b-256 28002ccf843850b6ec1084f50c3a7e362838cba18556eb4522aab0d95f37c86a

See more details on using hashes here.

File details

Details for the file routilux-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: routilux-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 83.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for routilux-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e12e7de7c6071a009251334a291e2ef86cb20e101cad3190bad2ea1c7381317f
MD5 ae51461959937790f39cb849da737b62
BLAKE2b-256 5121d2b90189d476940a4e679e08fcc2be4f8faf4b6c8b41ac34ebf74c468c01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page