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.2.tar.gz (34.5 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.2-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runmon-1.0.2.tar.gz
  • Upload date:
  • Size: 34.5 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.2.tar.gz
Algorithm Hash digest
SHA256 50a64b90ed522de362c70a8fb3e0b0290a36824ba3a1b5425465816511b18a01
MD5 e9cb96a622197f1b0361aa21b0107b7b
BLAKE2b-256 2d443207dc7b3ff8501bd5009376d3fa01e0a6e663b8381983cf0a62bbfdd271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: runmon-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 30.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 149b98bb1f26372f1b07d637b77c56c9e9b2add12df8cdca64df78b532861f51
MD5 1f666adfdede14ab6dc8cf78c5eca79e
BLAKE2b-256 00f20561053cdf17c6607ce30b062a5e905a0be4b67b270543a2e863897ffd8e

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