一个基于 Python 的分布式任务管理和调度系统,支持多种数据源提供者和灵活的任务调度配置。
git clone <repository-url>
cd vector-task-management
cp .env.example .env
# 编辑 .env 文件配置数据库连接等参数
docker-compose up -d
# HTTP (会自动跳转到 HTTPS)
curl -I http://localhost/health
# HTTPS
curl -k https://localhost/health
pip install -r requirements.txt
export MONGO_URL="mongodb://localhost:27017/vector"
export REDIS_URL="redis://localhost:6379/0"
export APP_HOST="0.0.0.0"
export APP_PORT="8000"
python main.py
http://localhost:8000/apiPOST /api/tasks Content-Type: application/json { "task_name": "示例任务", "schedule_expression": "0 */5 * * *", "enabled": true, "max_instances": 1, "retry_count": 3, "retry_delay": 60, "timeout": 300, "config": { "provider_type": "tester", "provider_data": { "test_param": "value" } } }
GET /api/tasks?page=1&page_size=20&enabled_only=true
GET /api/tasks/{task_id}
POST /api/tasks/{task_id}/update Content-Type: application/json { "enabled": false, "schedule_expression": "0 0 * * *" }
POST /api/tasks/{task_id}/execute
DELETE /api/tasks/{task_id}
GET /api/providers
GET /api/providers/{provider_name}
POST /api/providers Content-Type: application/json { "name": "my_provider", "description": "My custom provider", "code": "# Python provider code here" }
PUT /api/providers/{provider_name} Content-Type: application/json { "description": "Updated description", "code": "# Updated Python code" }
POST /api/providers/from-template Content-Type: application/json { "name": "weather_provider", "description": "Weather information provider", "custom_handler": "# Custom handler code" }
POST /api/providers/{provider_name}/test Content-Type: application/json { "config": { "test_param": "value" } }
GET /api/auth/login
GET /api/executions?task_id={task_id}&status=success&page=1&page_size=20
GET /api/executions/{execution_id}
GET /api/stats/tasks
POST /api/stats/cleanup
| 变量名 | 描述 | 默认值 |
|---|---|---|
MONGO_URL | MongoDB 连接字符串 | mongodb://localhost:27017/vector |
MONGO_ROOT_USERNAME | MongoDB 根用户名 | admin |
MONGO_ROOT_PASSWORD | MongoDB 根密码 | password |
MONGO_DATABASE | MongoDB 数据库名 | vector |
MONGO_PORT | MongoDB 端口 | 27017 |
REDIS_URL | Redis 连接字符串 | redis://localhost:6379/0 |
REDIS_PORT | Redis 端口 | 6379 |
| 变量名 | 描述 | 默认值 |
|---|---|---|
APP_HOST | 应用监听地址 | 0.0.0.0 |
APP_PORT | 应用监听端口 | 8000 |
APP_DEBUG | 调试模式 | false |
APP_SECRET | 应用密钥 | your-secret-key-here |
| 变量名 | 描述 | 默认值 |
|---|---|---|
SCHEDULER_TIMEZONE | 调度器时区 | UTC |
SCHEDULER_MAX_INSTANCES | 最大并发实例数 | 3 |
SCHEDULER_COALESCE | 合并延迟执行 | false |
| 变量名 | 描述 | 默认值 |
|---|---|---|
JWT_SECRET_KEY | JWT 密钥 | your-jwt-secret-key |
JWT_ACCESS_TOKEN_EXPIRES | 访问令牌过期时间(分钟) | 15 |
JWT_REFRESH_TOKEN_EXPIRES | 刷新令牌过期时间(天) | 30 |
* * * * * │ │ │ │ │ │ │ │ │ └─── 星期几 (0-7, 0和7都表示周日) │ │ │ └───── 月份 (1-12) │ │ └─────── 日期 (1-31) │ └───────── 小时 (0-23) └─────────── 分钟 (0-59)
0 */5 * * * - 每5分钟执行一次0 0 * * * - 每天午夜执行0 9 * * 1-5 - 工作日上午9点执行0 0 1 * * - 每月1号执行本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
如有问题或建议,请:
Vector Task Management System - 让任务调度更简单、更可靠!