PulseTask
轻量级、跨平台(Linux / Windows)的任务调度系统:Web 界面 + REST API + CLI 三种使用方式。
通过 Web 界面配置脚本任务的运行规则,支持按时间间隔、Crontab 触发或手动执行,提供任务管理、运行历史、日志查看等能力。
技术栈
| 层级 | 选型 |
|---|---|
| 前端 | 原生 HTML + Tailwind CSS + JS(无构建依赖,随包分发) |
| 后端 | Python 3.10+ / FastAPI |
| 调度 | APScheduler(interval / cron / manual) |
| 存储 | SQLite(WAL 模式,零配置) |
功能特性
- 触发方式:固定间隔 / Crontab 表达式(UTC)/ 手动执行
- 执行控制:超时强制终止整个进程树、失败自动重试、按任务并发锁(同一任务不重复执行,不同任务并行运行)
- Web 界面:仪表盘统计、任务列表(搜索/筛选)、弹窗式新建/编辑任务、运行历史分页、终端风格日志查看(自动滚动到底部)
- REST API:完整任务生命周期管理,内置 Swagger 文档(
/docs) - CLI 启动:支持
--host/--port/--db/--reload等参数 - 单 wheel 分发:
pip install后前端随包携带,开箱即用
快速开始
# 安装(任选其一;Python 包导入名为 pulsetask)
pip install pulse-task # pip
uv tool install pulse-task # uv,作为全局命令安装
# 从源码安装(开发模式)
uv venv .venv && uv pip install -e ".[dev]"
# 启动服务(默认 http://127.0.0.1:8000)
pulse-task
浏览器打开 http://127.0.0.1:8000 即可使用;API 文档在 http://127.0.0.1:8000/docs。
免安装直接运行:uvx pulse-task。
CLI 参数
pulse-task [--host HOST] [--port PORT] [--db PATH] [--ui DIR] [--reload] [--log-level LEVEL] [--version]
| 参数 | 默认值 | 说明 |
|---|---|---|
--host |
127.0.0.1 |
监听地址(环境变量 HOST 可改默认值) |
--port |
8000 |
监听端口(环境变量 PORT 可改默认值) |
--db |
<项目根>/pulsetask.db |
SQLite 数据库路径(等价于 PULSETASK_DB) |
--ui |
包内 ui/ 目录 |
前端静态页面目录(等价于 PULSETASK_UI) |
--reload |
关闭 | 开发模式:代码变更自动重启 |
--log-level |
info |
critical / error / warning / info / debug / trace |
--version |
— | 查看版本 |
等价入口:python -m pulsetask。也可 uvicorn pulsetask.app:app 直接启动(此时 --db / --ui 需用环境变量)。
API 概览
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/health |
健康检查 |
| GET | /api/dashboard |
仪表盘统计 |
| GET | /api/tasks |
任务列表(search / enabled / trigger_type 过滤) |
| POST | /api/tasks |
创建任务 |
| GET / PATCH / DELETE | /api/tasks/{id} |
任务详情 / 部分更新 / 删除 |
| POST | /api/tasks/{id}/enable /disable /run |
启用 / 禁用 / 立即执行 |
| GET | /api/tasks/{id}/history?limit=&offset= |
运行历史(分页) |
| GET | /api/tasks/{id}/logs?run_id= |
运行日志 |
| GET | /api/runs?limit=&offset= |
全局运行记录(分页) |
项目结构
PulseTask/
├── README.md # 本文档
├── DESIGN.md # 设计文档(架构 / 数据库 / API / 页面)
├── pyproject.toml
├── docs/ui-design/ # UI 设计阶段产物存档(不参与运行)
├── src/pulsetask/
│ ├── app.py # FastAPI 应用组装
│ ├── cli.py # 命令行入口
│ ├── api.py # /api 路由
│ ├── config.py # 配置解析
│ ├── schemas.py # 请求模型
│ ├── database.py # SQLite 数据访问层
│ ├── scheduler.py # 调度与命令执行
│ └── ui/pages/ # 前端静态页面 + 共享弹窗组件
└── pulsetask.db # SQLite 数据库(首次运行自动创建)
开发
.venv/Scripts/ruff.exe check src # 代码检查
.venv/Scripts/python.exe -m mypy # 类型检查(strict)
uv build # 构建 wheel / sdist 到 dist/
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pulse_task-0.1.0.tar.gz
(32.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pulse_task-0.1.0.tar.gz.
File metadata
- Download URL: pulse_task-0.1.0.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33d8ffe5a7932a93f0799ed54b7307d7461226b52ba9b9df3989c45b1a4844d7
|
|
| MD5 |
f5b74b0e1b36a9a339926584fc32f7d5
|
|
| BLAKE2b-256 |
e8e38befb4c9f77ea6c20612b1c38bcaf87da839656b31a0f075b454db27a5e9
|
File details
Details for the file pulse_task-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pulse_task-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a6fad73b731eeb75873b6f02ddc6fb6f38c489a1836ad52ebae56cf09b95a1
|
|
| MD5 |
e7e981a3fb071a9c5ef846cfa393077d
|
|
| BLAKE2b-256 |
053685c7c9e9647a10b8573ae8de8b41e901b928edfd283e771ef58e8f630fbf
|