feat: L1 server with persistent run storage

- FastAPI server on port 8100
- POST /runs to start rendering jobs
- GET /runs/{id} to check status
- Cache and run persistence in Redis
- Auto-generated API docs at /docs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-07 10:45:30 +00:00
parent 500e57b9a4
commit ba20c2dc63
3 changed files with 289 additions and 14 deletions

View File

@@ -1,12 +1,12 @@
# Art Celery
Distributed rendering for the Art DAG system using Celery.
L1 rendering server for the Art DAG system. Manages distributed rendering jobs via Celery workers.
## Dependencies
- **artdag** (GitHub): Core DAG execution engine
- **artdag-effects** (rose-ash): Effect implementations
- **Redis**: Message broker and result backend
- **Redis**: Message broker, result backend, and run persistence
## Setup
@@ -19,9 +19,48 @@ pip install -r requirements.txt
# Start a worker
celery -A celery_app worker --loglevel=info
# Start the L1 server
python server.py
```
## Usage
## L1 Server API
Interactive docs: http://localhost:8100/docs
### Endpoints
| Method | Path | Description |
|--------|------|-------------|
| GET | `/` | Server info |
| POST | `/runs` | Start a rendering run |
| GET | `/runs` | List all runs |
| GET | `/runs/{run_id}` | Get run status |
| GET | `/cache` | List cached content hashes |
| GET | `/cache/{hash}` | Download cached content |
| POST | `/cache/import?path=` | Import local file to cache |
| GET | `/assets` | List known assets |
### Start a run
```bash
curl -X POST http://localhost:8100/runs \
-H "Content-Type: application/json" \
-d '{"recipe": "dog", "inputs": ["33268b6e..."], "output_name": "my-output"}'
```
### Check run status
```bash
curl http://localhost:8100/runs/{run_id}
```
## Storage
- **Cache**: `~/.artdag/cache/` (content-addressed files)
- **Runs**: Redis db 5, keys `artdag:run:*` (persists across restarts)
## CLI Usage
```bash
# Render cat through dog effect
@@ -37,19 +76,23 @@ python render.py dog cat
## Architecture
```
render.py (CLI)
server.py (L1 Server - FastAPI)
celery_app.py (Celery broker)
├── POST /runs → Submit job
│ │
│ ▼
│ celery_app.py (Celery broker)
│ │
│ ▼
│ tasks.py (render_effect task)
│ │
│ ├── artdag (GitHub) - DAG execution
│ └── artdag-effects (rose-ash) - Effects
│ │
│ ▼
│ Output + Provenance
tasks.py (render_effect task)
├── artdag (GitHub) - DAG execution
└── artdag-effects (rose-ash) - Effect implementations
Provenance JSON + Output file
└── GET /cache/{hash} → Retrieve output
```
## Provenance