Skip to main content

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

runmon-1.0.0.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runmon-1.0.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file runmon-1.0.0.tar.gz.

File metadata

  • Download URL: runmon-1.0.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for runmon-1.0.0.tar.gz
Algorithm Hash digest
SHA256 520a5cded098c6d1e70d14f5c1b084b1e66f5c206b069001f6fe49b8a6121347
MD5 9c186db321d8aade28eb59f7da4fbd2f
BLAKE2b-256 7c72c487a8622e7317a4d2e1fd062fa319bb16ae3d97a476908a0bbda89c9e3c

See more details on using hashes here.

File details

Details for the file runmon-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: runmon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for runmon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9424b044eea4c4b6580e66402813abe865944710f1092bf57c59eeb62efb7c01
MD5 cbd7a54b32496e58c46cf62a42031421
BLAKE2b-256 5263db68eb0932e38d2aae072b7a9cebefc763050701f8234a39fafcb55c7850

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page