Crate taskflow_rs

Crate taskflow_rs 

Source
Expand description

taskflow-rs: A high-performance, async-first task orchestration framework for Rust

§Overview

taskflow-rs provides a robust framework for scheduling, executing, and managing asynchronous tasks with dependency resolution, automatic retries, and pluggable storage backends.

§Key Features

  • 🚀 Async-first architecture built on Tokio for maximum performance
  • 🔄 Automatic retry with configurable backoff strategies
  • 📋 Task dependencies for complex workflow orchestration
  • 🧩 Pluggable storage supporting multiple backend implementations
  • 📊 Real-time monitoring of task execution and system metrics
  • 🛡️ Memory safety guaranteed by Rust’s ownership model

§Quick Start

use taskflow_rs::TaskFlow;
use taskflow_rs::task::TaskDefinition;
 
#[tokio::main]
async fn main() -> Result<(), taskflow_rs::TaskFlowError> {
    // Create a new TaskFlow instance
    let taskflow = TaskFlow::new_default().await?;
     
    // Submit a task for execution
    let task_id = taskflow.submit_task(
        TaskDefinition::new("example", "python_handler")
            .with_payload("script", "print('Hello from TaskFlow!')")
    ).await?;
     
    // Wait for task completion and get result
    let result = taskflow.wait_for_task(task_id).await?;
    println!("Task result: {:?}", result);
     
    Ok(())
}

§Architecture

The framework consists of several core components:

  • TaskFlow: Main entry point and coordination layer
  • Scheduler: Responsible for task scheduling and dependency resolution
  • Executor: Handles task execution with multiple handler types
  • Storage: Abstract interface for task persistence
  • Task: Core data structures for task definitions and results

§Supported Task Handlers

  • Python script execution
  • File operations (create, read, write, delete)
  • HTTP requests
  • Shell command execution
  • Custom handlers (extensible via trait implementation)

Re-exports§

pub use error::TaskFlowError;
pub use executor::Executor;
pub use framework::TaskFlow;
pub use scheduler::Scheduler;
pub use task::Task;
pub use task::TaskDefinition;
pub use task::TaskResult;
pub use task::TaskStatus;

Modules§

error
executor
framework
scheduler
storage
task