Your code has a home.
Upload a Python file with a handler(payload) function. The API and workers share the task files volume, so workers can load new code without an image rebuild.
async def handler(payload):
return await process(payload)
From a Python function to a fleet of workers. Here’s how TaskFlow moves the work, tracks its state, and responds when things change.
A look inside the systemSwipe the map to explore →
Authenticates requests, accepts Python file uploads, and persists submitted tasks in PostgreSQL. Dispatch is handled by the queue manager.
Read the source ↗Walk through the normal execution path. Each stage has one job.
Upload a Python file with a handler(payload) function. The API and workers share the task files volume, so workers can load new code without an image rebuild.
async def handler(payload):
return await process(payload)
The API accepts work. The scheduler dispatches it. Workers execute it. Redis and PostgreSQL connect the pieces.
Authentication, uploads, task creation, and status queries through a REST interface.
api/routers/tasks.py ↗A leased leader schedules due tasks into high or low priority queues and checks for work needing recovery.
core/queue_manager.py ↗Workers move tasks to a processing list, load uploaded handlers, and update execution status.
worker/main.py ↗Task metadata and status live in PostgreSQL. PgBouncer pools connections. A shared volume holds Python files.
infrastructure/postgres.yaml ↗KEDA observes the low priority Redis queue and adjusts the worker deployment between 2 and 20 replicas.
The current manifest polls every 2 seconds, sets a target list length of 5, and configures a 30 second cooldown. Both priority queues are served by the same worker fleet.
Explore the scaling manifest ↗spec: minReplicaCount: 2 maxReplicaCount: 20 pollingInterval: 2 cooldownPeriod: 30 triggers: - type: redis metadata: listName: default listLength: "5"
A focused excerpt from the current manifest.
Heartbeats, leader leases, and reconciliation give the system ways to detect interrupted work. Handlers should tolerate being run again.
Workers publish heartbeats every 3 seconds with a 10 second TTL. The queue manager scans running tasks every 10 seconds and requeues tasks whose worker heartbeat is missing, up to 3 retries.
Inspect heartbeat handling ↗Leadership uses a Redis lease with a 10 second TTL, renewed every 3 seconds. A contender can acquire the lock after the lease expires; the Kubernetes manifest currently runs one queue manager replica.
A reconciliation loop republishes queued tasks every 30 seconds. This can produce duplicate delivery, so task handlers should be idempotent. A separate loop inspects stale entries in the low priority processing list.
The worker marks the task FAILED and removes its message from the processing list. The dynamic handler wrapper also sets a 180 second timeout. The current worker records task status rather than persisting the handler’s return value.
Inspect handler execution ↗The source is open. The next task is yours.