task Runner
Project description
BP Runner
BP Runner 是一个轻量级的命令行任务执行引擎,用于管理和监控长时间运行的业务流程。
功能特性
- ✅ 支持命令行任务执行与监控
- ✅ 自动生成执行脚本和环境配置
- ✅ 提供任务状态、PID、执行统计信息记录
- ✅ 支持任务取消和清理
- ✅ 完善的日志记录和错误输出
安装
pip install bp-runner
配置文件
创建配置文件 config.yaml:
command: ls -l /etc # 要执行的命令
env:
ENV1: value1 # 环境变量
ENV2: value2
task_dir: ./task # 任务目录
work_dir: ./work # 工作目录
运行任务
- 创建 Runner 实例
from bp_runner import Runner
runner = Runner(config)
runner.run()
- 命令行运行
bp-runner -c config.yaml
配置选项
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| command | str/list | 是 | 要执行的命令 |
| task_dir | str | 是 | 任务输出目录 |
| work_dir | str | 否 | 命令工作目录 |
| env | dict | 否 | 环境变量配置 |
任务管理
# 获取任务状态
status = runner.get_status()
# 获取执行统计
stats = runner.get_stat()
# 取消任务
runner.cancel()
# 清理任务
runner.delete()
输出文件
任务执行后会生成以下文件:
status.yaml - 任务状态
pid.yaml - 进程ID
stat.yaml - 执行统计
output.log - 标准输出
err.log - 错误输出
run.sh - 生成的执行脚本
许可证 MIT License - 详见 LICENSE 文件
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bp_runner-0.1.2.tar.gz
(377.2 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
bp_runner-0.1.2-py3-none-any.whl
(377.9 kB
view details)
File details
Details for the file bp_runner-0.1.2.tar.gz.
File metadata
- Download URL: bp_runner-0.1.2.tar.gz
- Upload date:
- Size: 377.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a342811e53b70866d4e71660869310214f485067206eb908124f328fa67555
|
|
| MD5 |
dd302407b16fbae7948767d3e45ddd96
|
|
| BLAKE2b-256 |
fdd5b445966058c568d26763bf318d53867a81a3ee796723ef09414212e32556
|
File details
Details for the file bp_runner-0.1.2-py3-none-any.whl.
File metadata
- Download URL: bp_runner-0.1.2-py3-none-any.whl
- Upload date:
- Size: 377.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d56abf91d4c3721e9fb58416a6b7b1fd32bdaa019035a4628e9dc343f651594
|
|
| MD5 |
631c322d20fd711079c04720bf1efcbc
|
|
| BLAKE2b-256 |
ce0ac6550403b27f045d25f5c3c6628627e4efeecea5a727b6e5f2c9af6304ad
|