57 lines
1.2 KiB
Markdown
57 lines
1.2 KiB
Markdown
|
|
---
|
||
|
|
name: task-queue
|
||
|
|
description: |
|
||
|
|
Redis-based task queue for Kimi's background tasks.
|
||
|
|
Simple heartbeat-driven task execution with active task checking.
|
||
|
|
metadata:
|
||
|
|
openclaw:
|
||
|
|
os: ["linux"]
|
||
|
|
---
|
||
|
|
|
||
|
|
# Task Queue
|
||
|
|
|
||
|
|
Redis-based task queue for Kimi's own background tasks.
|
||
|
|
|
||
|
|
## Architecture
|
||
|
|
|
||
|
|
**Redis Keys:**
|
||
|
|
- `tasks:pending` - List of task IDs waiting (FIFO)
|
||
|
|
- `tasks:active` - List of currently active tasks (0-1 items)
|
||
|
|
- `tasks:completed` - List of completed task IDs
|
||
|
|
- `task:{id}` - Hash with full task details
|
||
|
|
|
||
|
|
**Task Fields:**
|
||
|
|
- `id` - Unique task ID
|
||
|
|
- `description` - What to do
|
||
|
|
- `status` - pending/active/completed/failed
|
||
|
|
- `created_at` - Timestamp
|
||
|
|
- `started_at` - When picked up
|
||
|
|
- `completed_at` - When finished
|
||
|
|
- `created_by` - Who created the task
|
||
|
|
- `result` - Output from execution
|
||
|
|
|
||
|
|
## Scripts
|
||
|
|
|
||
|
|
### heartbeat_worker.py
|
||
|
|
Check for tasks at heartbeat, execute if available:
|
||
|
|
```bash
|
||
|
|
python3 scripts/heartbeat_worker.py
|
||
|
|
```
|
||
|
|
|
||
|
|
### add_task.py
|
||
|
|
Add a task to the queue:
|
||
|
|
```bash
|
||
|
|
python3 scripts/add_task.py "Check server disk space"
|
||
|
|
```
|
||
|
|
|
||
|
|
### list_tasks.py
|
||
|
|
View pending/active/completed tasks:
|
||
|
|
```bash
|
||
|
|
python3 scripts/list_tasks.py
|
||
|
|
```
|
||
|
|
|
||
|
|
## Redis Config
|
||
|
|
- Host: 10.0.0.36
|
||
|
|
- Port: 6379
|
||
|
|
- No auth (local network)
|