# pulkittiwari87/atlas architecture

> Architecture diagram of the GitHub repository pulkittiwari87/atlas, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pulkittiwari87/atlas
- Repository: https://github.com/pulkittiwari87/atlas

## Overview

ATLAS is a distributed job-execution platform. Clients submit jobs through REST; the service persists jobs and tasks, then scheduling and dispatch route work to worker runtimes for execution and attempt persistence. Heartbeats feed failure detection, which triggers recovery and retries. The graph also shows the gRPC transport and the shared PostgreSQL source of truth. Some internal wiring is supported only by README descriptions or source-index references; those limits are reflected in the evidence citations.

Main entry points: [`src/atlas/services/job_service.py`](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/services/job_service.py) (Job Service), [`src/atlas/persistence/repositories.py`](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/repositories.py) (Repositories), [`src/atlas/dispatch/dispatcher.py`](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/dispatch/dispatcher.py) (Dispatcher), [`src/atlas/worker/grpc_client.py`](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/worker/grpc_client.py) (Worker gRPC Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Job Intake"]
  node_api["REST API<br/>[jobs.py]"]
  node_job_service["Job Service<br/>[job_service.py]"]
  node_domain["Job and Task Model<br/>[task.py]"]
end

subgraph group_coord["Control Plane"]
  node_scheduler["Priority Scheduler<br/>[scheduler.py]"]
  node_dispatch_loop["Dispatch Loop<br/>[loop.py]"]
  node_dispatcher["Dispatcher<br/>[dispatcher.py]"]
  node_failure["Failure Detector<br/>[detector.py]"]
  node_recovery["Recovery Manager<br/>[recovery.py]"]
end

subgraph group_workers["Worker Execution"]
  node_grpc_server["gRPC Server<br/>[server.py]"]
  node_grpc_service["Worker Service<br/>[service.py]"]
  node_grpc_registry["gRPC Worker Registry<br/>[registry.py]"]
  node_worker_client["Worker gRPC Client<br/>[grpc_client.py]"]
  node_runtime["Worker Runtime<br/>[runtime.py]"]
end

subgraph group_state["State and Observability"]
  node_db_session["Database Sessions<br/>[db.py]"]
  node_repositories["Repositories<br/>[repositories.py]"]
  node_models["Database Models<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
  node_observability["Structured Events<br/>[logging.py]"]
end

node_client(("Client"))
node_worker_process(("Worker Process"))

node_client -->|"submits jobs"| node_api
node_api -->|"calls"| node_job_service
node_api -->|"routes requests"| node_job_service
node_job_service -->|"persists jobs"| node_repositories
node_job_service -->|"creates and transitions"| node_domain
node_job_service -->|"logs events"| node_observability
node_scheduler -->|"selects runnable tasks"| node_postgres
node_dispatch_loop -->|"requests proposals"| node_scheduler
node_dispatch_loop -->|"dispatches proposals"| node_dispatcher
node_dispatcher -->|"looks up workers"| node_grpc_registry
node_dispatcher -->|"dispatches tasks"| node_runtime
node_dispatcher -->|"logs outcomes"| node_observability
node_grpc_server -->|"registers service"| node_grpc_service
node_grpc_service -->|"registers workers and delivers results"| node_grpc_registry
node_grpc_service -->|"updates worker records"| node_repositories
node_worker_process -->|"runs"| node_worker_client
node_worker_client -->|"uses gRPC"| node_grpc_server
node_worker_client -->|"delegates execution"| node_runtime
node_worker_client -->|"sends heartbeats"| node_grpc_service
node_runtime -->|"persists attempts and task state"| node_repositories
node_failure -->|"checks heartbeats"| node_postgres
node_failure -->|"triggers recovery"| node_recovery
node_recovery -->|"recovers tasks and retries"| node_postgres
node_job_service -->|"opens transactions"| node_db_session
node_repositories -->|"maps database rows"| node_models
node_db_session -->|"commits transactions"| node_postgres
node_repositories -->|"reads and writes state"| node_postgres

click node_api "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/api/routes/jobs.py"
click node_job_service "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/services/job_service.py"
click node_domain "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/domain/task.py"
click node_scheduler "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/scheduler/scheduler.py"
click node_dispatch_loop "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/dispatch/loop.py"
click node_dispatcher "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/dispatch/dispatcher.py"
click node_failure "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/failure_detection/detector.py"
click node_recovery "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/recovery/recovery.py"
click node_grpc_server "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/server.py"
click node_grpc_service "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/service.py"
click node_grpc_registry "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/registry.py"
click node_worker_client "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/worker/grpc_client.py"
click node_runtime "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/worker/runtime.py"
click node_db_session "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/db.py"
click node_repositories "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/repositories.py"
click node_models "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/models.py"
click node_observability "https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/observability/logging.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_api,node_job_service,node_domain,node_client toneBlue
class node_scheduler,node_dispatch_loop,node_dispatcher,node_failure,node_recovery toneAmber
class node_grpc_server,node_grpc_service,node_grpc_registry,node_worker_client,node_runtime toneMint
class node_db_session,node_repositories,node_models,node_postgres,node_observability,node_worker_process toneRose
```

## Components

### Job Intake

- [REST API](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/api/routes/jobs.py): `src/atlas/api/routes/jobs.py`
- [Job Service](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/services/job_service.py): `src/atlas/services/job_service.py`
- [Job and Task Model](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/domain/task.py): `src/atlas/domain/task.py`

### Control Plane

- [Priority Scheduler](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/scheduler/scheduler.py): `src/atlas/scheduler/scheduler.py`
- [Dispatch Loop](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/dispatch/loop.py): `src/atlas/dispatch/loop.py`
- [Dispatcher](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/dispatch/dispatcher.py): `src/atlas/dispatch/dispatcher.py`
- [Failure Detector](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/failure_detection/detector.py): `src/atlas/failure_detection/detector.py`
- [Recovery Manager](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/recovery/recovery.py): `src/atlas/recovery/recovery.py`

### Worker Execution

- [gRPC Server](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/server.py): `src/atlas/grpc_server/server.py`
- [Worker Service](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/service.py): `src/atlas/grpc_server/service.py`
- [gRPC Worker Registry](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/grpc_server/registry.py): `src/atlas/grpc_server/registry.py`
- [Worker gRPC Client](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/worker/grpc_client.py): `src/atlas/worker/grpc_client.py`
- [Worker Runtime](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/worker/runtime.py): `src/atlas/worker/runtime.py`

### State and Observability

- [Database Sessions](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/db.py): `src/atlas/persistence/db.py`
- [Repositories](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/repositories.py): `src/atlas/persistence/repositories.py`
- [Database Models](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/persistence/models.py): `src/atlas/persistence/models.py`
- **PostgreSQL**
- [Structured Events](https://github.com/pulkittiwari87/atlas/blob/main/src/atlas/observability/logging.py): `src/atlas/observability/logging.py`

### Other components

- **Client**
- **Worker Process**

## Connections

- Client → REST API: submits jobs (evidence: `README.md`)
- REST API → Job Service: calls (evidence: `src/atlas/api/routes/jobs.py`)
- REST API → Job Service: routes requests
- Job Service → Repositories: persists jobs (evidence: `src/atlas/services/job_service.py`)
- Job Service → Job and Task Model: creates and transitions (evidence: `src/atlas/services/job_service.py`)
- Job Service → Structured Events: logs events (evidence: `src/atlas/services/job_service.py`)
- Priority Scheduler → PostgreSQL: selects runnable tasks (evidence: `README.md`)
- Dispatch Loop → Priority Scheduler: requests proposals (evidence: `src/atlas/dispatch/loop.py`)
- Dispatch Loop → Dispatcher: dispatches proposals (evidence: `src/atlas/dispatch/loop.py`)
- Dispatcher → gRPC Worker Registry: looks up workers (evidence: `src/atlas/dispatch/dispatcher.py`)
- Dispatcher → Worker Runtime: dispatches tasks (evidence: `README.md`)
- Dispatcher → Structured Events: logs outcomes (evidence: `src/atlas/dispatch/dispatcher.py`)
- gRPC Server → Worker Service: registers service (evidence: `src/atlas/grpc_server/server.py`)
- Worker Service → gRPC Worker Registry: registers workers and delivers results (evidence: `src/atlas/grpc_server/service.py`)
- Worker Service → Repositories: updates worker records (evidence: `src/atlas/grpc_server/service.py`)
- Worker Process → Worker gRPC Client: runs
- Worker gRPC Client → gRPC Server: uses gRPC (evidence: `src/atlas/worker/grpc_client.py`)
- Worker gRPC Client → Worker Runtime: delegates execution (evidence: `src/atlas/worker/grpc_client.py`)
- Worker gRPC Client → Worker Service: sends heartbeats (evidence: `src/atlas/worker/grpc_client.py`)
- Worker Runtime → Repositories: persists attempts and task state (evidence: `README.md`)
- Failure Detector → PostgreSQL: checks heartbeats (evidence: `README.md`)
- Failure Detector → Recovery Manager: triggers recovery (evidence: `README.md`)
- Recovery Manager → PostgreSQL: recovers tasks and retries (evidence: `README.md`)
- Job Service → Database Sessions: opens transactions (evidence: `src/atlas/services/job_service.py`)
- Repositories → Database Models: maps database rows (evidence: `src/atlas/persistence/repositories.py`)
- Database Sessions → PostgreSQL: commits transactions (evidence: `src/atlas/persistence/db.py`)
- Repositories → PostgreSQL: reads and writes state (evidence: `README.md`)
