# dkush2024-dot/e-waste-computer-grid architecture

> Architecture diagram of the GitHub repository dkush2024-dot/e-waste-computer-grid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dkush2024-dot/e-waste-computer-grid
- Repository: https://github.com/dkush2024-dot/e-waste-computer-grid

## Overview

E-Waste Compute Grid coordinates batch jobs across older computers: administrators submit dummy or image-classification workloads, the control plane stores and dispatches tasks to registered workers, workers execute them and report results, and the dashboard presents grid and job status. The repository also includes energy accounting, scheduling, result aggregation, and model-artifact management. The map follows documented capabilities and sampled call/reference evidence; some workload and reporting links are omitted where their runtime wiring was not shown.

Main entry points: [`control-plane/src/app.ts`](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/app.ts) (HTTP API and orchestration), [`worker/api_client.py`](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/api_client.py) (Control-plane API client), [`worker/task_executor.py`](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/task_executor.py) (Task executor), [`control-plane/src/storage.ts`](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/storage.ts) (Input and result storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Grid dashboard<br/>[App.tsx]"]
  node_dashboard_api["Dashboard API client<br/>[api.ts]"]
end

subgraph group_control["Control Plane"]
  node_api["HTTP API and orchestration<br/>[app.ts]"]
  node_validation["Job and result validation<br/>[validation.ts]"]
  node_config["Control-plane configuration<br/>[config.ts]"]
  node_storage["Input and result storage<br/>[storage.ts]"]
  node_database[("Coordination database<br/>[schema.prisma]")]
end

subgraph group_worker["Worker Runtime"]
  node_worker_agent["Worker agent<br/>[agent.py]"]
  node_worker_api["Control-plane API client<br/>[api_client.py]"]
  node_worker_config["Worker configuration<br/>[config.py]"]
  node_hardware["Hardware discovery<br/>[hardware.py]"]
  node_executor["Task executor<br/>[task_executor.py]"]
end

subgraph group_compute["Workloads &amp; Compute"]
  node_task_runner["Task runner and metrics<br/>[task_runner.py]"]
  node_dummy["Deterministic demo workload<br/>[run_dummy.py]"]
  node_inference["MobileNetV2 inference<br/>[run_inference.py]"]
  node_model_manager["Model artifact manager"]
  node_energy["Energy and savings calculator"]
  node_power_meter["Power measurement<br/>[power_meter.py]"]
  node_scheduler["Scheduling scorer"]
  node_aggregator["Result aggregation"]
end

node_admin(("Grid administrator"))
node_object_store[("S3 object storage")]

node_admin -->|"manages jobs"| node_dashboard_app
node_dashboard_app -->|"requests data"| node_dashboard_api
node_dashboard_api -.->|"calls HTTP API"| node_api
node_worker_agent -->|"uses client"| node_worker_api
node_worker_agent -->|"runs tasks"| node_executor
node_worker_api -->|"calls worker endpoints"| node_api
node_api -->|"validates requests"| node_validation
node_api -->|"reads and writes objects"| node_storage
node_storage -->|"uses settings"| node_config
node_storage -.->|"stores objects"| node_object_store
node_api -.->|"coordinates jobs"| node_database
node_worker_api -->|"reports capabilities"| node_hardware
node_worker_api -->|"uses settings"| node_worker_config
node_executor -->|"uses settings"| node_worker_config
node_executor -.->|"runs configured workload"| node_dummy
node_executor -.->|"runs configured workload"| node_inference
node_model_manager -->|"downloads artifacts"| node_object_store
node_task_runner -->|"estimates energy"| node_energy
node_power_meter -->|"uses calculations"| node_energy
node_scheduler -->|"uses energy estimates"| node_energy

click node_dashboard_app "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/frontend/src/App.tsx"
click node_dashboard_api "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/frontend/src/services/api.ts"
click node_api "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/app.ts"
click node_validation "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/validation.ts"
click node_config "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/config.ts"
click node_storage "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/storage.ts"
click node_database "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/prisma/schema.prisma"
click node_worker_agent "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/agent.py"
click node_worker_api "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/api_client.py"
click node_worker_config "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/config.py"
click node_hardware "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/hardware.py"
click node_executor "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/task_executor.py"
click node_task_runner "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/task_runner.py"
click node_dummy "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/dummy-workload/run_dummy.py"
click node_inference "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/ai-inference/run_inference.py"
click node_model_manager "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/ai-inference/s3_model_manager.py"
click node_energy "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/energy/energy_calculator.py"
click node_power_meter "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/energy/power_meter.py"
click node_scheduler "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/scheduler_scorer.py"
click node_aggregator "https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/result_aggregator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard_app,node_dashboard_api toneBlue
class node_api,node_validation,node_config,node_storage,node_database,node_object_store toneAmber
class node_worker_agent,node_worker_api,node_worker_config,node_hardware,node_executor toneMint
class node_task_runner,node_dummy,node_inference,node_model_manager,node_energy,node_power_meter,node_scheduler,node_aggregator toneRose
class node_admin toneIndigo
```

## Components

### Dashboard

- [Grid dashboard](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard API client](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Control Plane

- [HTTP API and orchestration](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/app.ts): `control-plane/src/app.ts`
- [Job and result validation](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/validation.ts): `control-plane/src/validation.ts`
- [Control-plane configuration](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/config.ts): `control-plane/src/config.ts`
- [Input and result storage](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/src/storage.ts): `control-plane/src/storage.ts`
- [Coordination database](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/control-plane/prisma/schema.prisma): `control-plane/prisma/schema.prisma`

### Worker Runtime

- [Worker agent](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/agent.py): `worker/agent.py`
- [Control-plane API client](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/api_client.py): `worker/api_client.py`
- [Worker configuration](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/config.py): `worker/config.py`
- [Hardware discovery](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/hardware.py): `worker/hardware.py`
- [Task executor](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/worker/task_executor.py): `worker/task_executor.py`

### Workloads & Compute

- [Task runner and metrics](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/task_runner.py): `workloads/task_runner.py`
- [Deterministic demo workload](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/dummy-workload/run_dummy.py): `workloads/dummy-workload/run_dummy.py`
- [MobileNetV2 inference](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/ai-inference/run_inference.py): `workloads/ai-inference/run_inference.py`
- [Model artifact manager](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/ai-inference/s3_model_manager.py): `workloads/ai-inference/s3_model_manager.py`
- [Energy and savings calculator](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/energy/energy_calculator.py): `workloads/energy/energy_calculator.py`
- [Power measurement](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/energy/power_meter.py): `workloads/energy/power_meter.py`
- [Scheduling scorer](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/scheduler_scorer.py): `workloads/scheduler_scorer.py`
- [Result aggregation](https://github.com/dkush2024-dot/e-waste-computer-grid/blob/main/workloads/result_aggregator.py): `workloads/result_aggregator.py`

### Other components

- **Grid administrator**
- **S3 object storage**

## Connections

- Grid administrator → Grid dashboard: manages jobs (evidence: `README.md`)
- Grid dashboard → Dashboard API client: requests data (evidence: `frontend/src/App.tsx`)
- Dashboard API client → HTTP API and orchestration: calls HTTP API
- Worker agent → Control-plane API client: uses client (evidence: `worker/agent.py`)
- Worker agent → Task executor: runs tasks (evidence: `worker/agent.py`)
- Control-plane API client → HTTP API and orchestration: calls worker endpoints (evidence: `worker/api_client.py`)
- HTTP API and orchestration → Job and result validation: validates requests (evidence: `control-plane/src/app.ts`)
- HTTP API and orchestration → Input and result storage: reads and writes objects (evidence: `control-plane/src/app.ts`)
- Input and result storage → Control-plane configuration: uses settings (evidence: `control-plane/src/storage.ts`)
- Input and result storage → S3 object storage: stores objects
- HTTP API and orchestration → Coordination database: coordinates jobs
- Control-plane API client → Hardware discovery: reports capabilities (evidence: `worker/api_client.py`)
- Control-plane API client → Worker configuration: uses settings (evidence: `worker/api_client.py`)
- Task executor → Worker configuration: uses settings (evidence: `worker/task_executor.py`)
- Task executor → Deterministic demo workload: runs configured workload
- Task executor → MobileNetV2 inference: runs configured workload
- Model artifact manager → S3 object storage: downloads artifacts (evidence: `workloads/ai-inference/s3_model_manager.py`)
- Task runner and metrics → Energy and savings calculator: estimates energy (evidence: `workloads/task_runner.py`)
- Power measurement → Energy and savings calculator: uses calculations (evidence: `workloads/energy/power_meter.py`)
- Scheduling scorer → Energy and savings calculator: uses energy estimates (evidence: `workloads/scheduler_scorer.py`)
