- 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>
116 lines
2.6 KiB
Markdown
116 lines
2.6 KiB
Markdown
# Art 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, result backend, and run persistence
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
# Install Redis
|
|
sudo apt install redis-server
|
|
|
|
# Install Python dependencies
|
|
pip install -r requirements.txt
|
|
|
|
# Start a worker
|
|
celery -A celery_app worker --loglevel=info
|
|
|
|
# Start the L1 server
|
|
python server.py
|
|
```
|
|
|
|
## 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
|
|
python render.py dog cat --sync
|
|
|
|
# Render cat through identity effect
|
|
python render.py identity cat --sync
|
|
|
|
# Submit async (don't wait)
|
|
python render.py dog cat
|
|
```
|
|
|
|
## Architecture
|
|
|
|
```
|
|
server.py (L1 Server - FastAPI)
|
|
│
|
|
├── 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
|
|
│
|
|
└── GET /cache/{hash} → Retrieve output
|
|
```
|
|
|
|
## Provenance
|
|
|
|
Every render produces a provenance record:
|
|
|
|
```json
|
|
{
|
|
"task_id": "celery-task-uuid",
|
|
"rendered_at": "2026-01-07T...",
|
|
"rendered_by": "@giles@artdag.rose-ash.com",
|
|
"output": {"name": "...", "content_hash": "..."},
|
|
"inputs": [...],
|
|
"effects": [...],
|
|
"infrastructure": {
|
|
"software": {"name": "infra:artdag", "content_hash": "..."},
|
|
"hardware": {"name": "infra:giles-hp", "content_hash": "..."}
|
|
}
|
|
}
|
|
```
|