# irfan-khan-96/taskstream architecture

> Architecture diagram of the GitHub repository irfan-khan-96/taskstream, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/irfan-khan-96/taskstream
- Repository: https://github.com/irfan-khan-96/taskstream

## Overview

##### Main Components

- Scheduler (from scheduler.py)
- Task Queue (from task_queue.py)
- Worker Nodes (from worker_node.py)

##### Component Relationships

a) Central Task Queue:
- This is the core message broker of the system

b) Scheduler Component:

c) Worker Nodes:
- Multiple worker node instances at the bottom
- Receiving tasks
- Sending status updates

##### Flow Representation

1. Task Submission Flow:
- From Scheduler to Task Queue
2. Task Distribution Flow:
- From Task Queue to Worker Nodes
3. Status Update Flow:
- From Worker Nodes back to Task Queue
4. Task Completion Flow:
- From Worker Nodes back to Scheduler

##### Additional Elements

Important aspects:
- State management indicators
- Task priority queues (if implemented)
- Health check mechanisms
- Load balancing indicators between workers

##### Specific Details

a) For the Scheduler:
- Task distribution logic
- Scheduling policies
- Load balancing mechanisms

b) For the Task Queue:
- Queue management
- Priority handling
- Task storage mechanism

c) For Worker Nodes:
- Task execution capabilities
- Resource management
- Health monitoring

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef scheduler fill:#2196F3,stroke:#1565C0,color:white
    classDef queue fill:#FFC107,stroke:#FFA000,color:black
    classDef worker fill:#4CAF50,stroke:#388E3C,color:white
    classDef critical fill:#F44336,stroke:#D32F2F,color:white
    classDef flow fill:none,stroke:#78909C,color:black

    %% Components
    Scheduler["Scheduler<br/>(Task Distribution & Load Balancing)"]:::scheduler
    TaskQueue[("Task Queue<br/>(Priority & State Management)")]:::queue
    Worker1["Worker Node 1<br/>(Task Execution)"]:::worker
    Worker2["Worker Node 2<br/>(Task Execution)"]:::worker
    Worker3["Worker Node 3<br/>(Task Execution)"]:::worker

    %% Relationships
    Scheduler -->|Submit Tasks| TaskQueue
    TaskQueue -->|Distribute Tasks| Worker1
    TaskQueue -->|Distribute Tasks| Worker2
    TaskQueue -->|Distribute Tasks| Worker3
    Worker1 -->|Status Updates| TaskQueue
    Worker2 -->|Status Updates| TaskQueue
    Worker3 -->|Status Updates| TaskQueue
    Worker1 -.->|Task Completion| Scheduler
    Worker2 -.->|Task Completion| Scheduler
    Worker3 -.->|Task Completion| Scheduler

    %% Legend
    subgraph Legend
        L1["Scheduler Component"]:::scheduler
        L2[("Queue Component")]:::queue
        L3["Worker Node"]:::worker
        L4["Critical Path"]:::critical
        L5[" "]:::flow
    end

    %% Click Events
    click Scheduler "https://github.com/irfan-khan-96/taskstream/blob/main/scheduler.py"
    click TaskQueue "https://github.com/irfan-khan-96/taskstream/blob/main/task_queue.py"
    click Worker1 "https://github.com/irfan-khan-96/taskstream/blob/main/worker_node.py"
    click Worker2 "https://github.com/irfan-khan-96/taskstream/blob/main/worker_node.py"
    click Worker3 "https://github.com/irfan-khan-96/taskstream/blob/main/worker_node.py"
```
