runqy Worker¶
The runqy worker (runqy-worker) is a Go binary that processes tasks from Redis and supervises Python processes.
Overview¶
The worker:
- Bootstraps by registering with the server and deploying task code
- Supervises a Python process for task execution
- Processes tasks from Redis queues
- Reports health status via heartbeat
Installation¶
Running¶
Lifecycle¶
- Register: Worker calls
POST /worker/registeron the server - Deploy: Clone git repository and set up Python environment
- Start: Spawn Python process using
startup_cmd - Wait: Wait for
{"status": "ready"}from Python - Process: Dequeue tasks, send to Python, write results to Redis
- Heartbeat: Periodically update worker status in Redis
Source Code¶
The worker is implemented in Go (~2500 lines of code):
runqy-worker/
├── cmd/worker/ # Binary entry point
├── internal/
│ ├── bootstrap/ # server_client, code_deploy, process_supervisor
│ ├── handler/ # stdio_handler, oneshot_handler
│ └── redis/ # Redis operations
├── worker.go # Main Worker struct
├── processor.go # Task dequeue loop
└── *.go # handler, task, heartbeat, retry, config