Long-job companion: phone notifications when your training finishes, fails, or silently hangs.
Project description
runmon
长任务陪伴器 —— 服务器上跑训练/爬虫/长脚本时,手机第一时间知道"跑完了、挂了、还是假死了"。零侵入,不改一行训练代码。
快速开始
pip install runmon
# 1. 配置通知通道(推荐 ntfy:手机装 ntfy app,订阅一个自定义 topic 即可)
mon init --ntfy-topic my-secret-topic-2333
# 2. 用 mon run 包装你的命令
mon run -- python train.py
# 先试试演示任务
mon demo # 正常完成 → 收到 ✅ 通知
mon demo --fail # 模拟报错 → 收到 ⚠️ + ❌ 通知
你会在手机上收到什么
| 事件 | 触发条件(默认,可配) | 级别 |
|---|---|---|
| ✅ 完成 | 退出码 0 | 信息 |
| ❌ 失败 | 退出码非 0 | 严重 |
| ⚠️ 错误输出 | 日志出现 Traceback / CUDA OOM / Segfault | 严重 |
| 🧊 GPU 假死 | 进程活着但 GPU 利用率 <5% 持续 10 分钟 | 严重 |
| 🤫 日志静默 | 30 分钟无新输出 | 警告 |
| 💾 磁盘告警 | 任一挂载点使用率 >90% | 警告 |
同类事件 30 分钟内只提醒一次;通知失败自动指数退避重试(最长 1 小时),本地持久化不丢。
常用命令
mon run --name exp1 --gpu 0,1 -- python train.py # 命名任务并显式关联 GPU
mon ls # 任务列表(进度/耗时)
mon status exp1 # 详情 + 输出尾部 + ETA/loss
mon stop exp1 # 停止(SIGINT→SIGTERM→SIGKILL)
进度、ETA、loss 从 stdout 自动解析(兼容 tqdm / Epoch x/y / loss=…),无需埋点。
通知通道
mon init 支持组合配置,可同时推多个通道:
mon init --ntfy-topic TOPIC [--ntfy-server https://你的自托管ntfy]
mon init --bark-key KEY # iOS Bark
mon init --telegram BOT_TOKEN:CHAT_ID # Telegram bot
mon init --webhook https://your/hook # 通用 webhook(飞书/钉钉/自定义)
配置写在 ~/.config/runmon/config.toml,阈值均可修改:
hang_gpu_minutes = 20 # 假死判定窗口
silence_minutes = 60 # 静默告警
disk_threshold_pct = 85
当前限制(Roadmap 见仓库根 README)
mon attach(接管已在 tmux 里跑的任务)在 M3- 手机 App(实时面板/远程操作)在 M2,当前通知为单向
- GPU 采集依赖 NVIDIA NVML,无 GPU 机器上自动降级(其余功能不受影响)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 runmon-1.0.1.tar.gz.
File metadata
- Download URL: runmon-1.0.1.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3a7b8f6d4586f0229559070f164380886adcfbcdd5748d614d6a1508374ef9
|
|
| MD5 |
a9a15df2b8a7c8771e52934fe82af6df
|
|
| BLAKE2b-256 |
22df6a309e658e35dd9c6f08133570c3ec447a8396e47b6e35ce84f5e8aa51c4
|
File details
Details for the file runmon-1.0.1-py3-none-any.whl.
File metadata
- Download URL: runmon-1.0.1-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
103888c33e07ca6232e46919064d898bc19589564e102a65c9b8beb42b4ce13c
|
|
| MD5 |
9f3d6d4221c969125223c093d6addff8
|
|
| BLAKE2b-256 |
14268ee25389739b01b448c4cdfbe4bfb5462f4e0c2ede3d20c9b915aae7c23e
|