Skip to main content

LogWatch 客户端 - 包裹命令并上传日志到监控服务器

Project description

LogWatch Client (lw)

LogWatch 客户端 - 包裹命令并上传日志到监控服务器的命令行工具。

🚀 安装

使用 uv (推荐)

uv tool install logwatch-client

使用 pip

pip install logwatch-client

从源码安装

cd client
uv pip install -e .

📖 使用方式

基本使用

# 包裹命令执行,自动上传日志
lw python train.py

# 指定任务名称
lw --name "resnet-v2-training" python train.py

# 指定服务器
lw --server http://your-server.com:8000 python train.py

配置文件

首次使用前,运行 --init 生成配置模板:

lw --init

配置文件位于 ~/.lwconfig

# LogWatch 客户端配置
# 服务器地址(必填)
server=http://your-server.com:8000

# 机器标识(可选,默认使用 hostname)
machine=my-gpu-server

# 用户 ID(用于鉴权/多用户隔离)
user_id=alice

命令行参数

参数 说明
--name, -n 任务名称(默认自动生成)
--server, -s 服务器地址(默认读取 ~/.lwconfig)
--machine, -m 机器标识(默认使用 hostname)
--user-id, -u 用户 ID(默认读取 ~/.lwconfig)
--init 生成配置文件模板
--no-check 跳过服务器连通性检查

✨ 特性

  • 零依赖:仅使用 Python 标准库
  • 实时上传:每 2 秒增量上传日志
  • 心跳监测:自动发送心跳,服务端可检测任务存活状态
  • 失败重试:网络波动时自动重试,支持熔断保护
  • 离线模式:服务器不可达时可选择离线模式,仅记录本地日志
  • 跨平台:支持 Linux 和 macOS

📋 系统要求

  • Python 3.8+
  • Linux 或 macOS(使用 PTY 捕获输出)

📄 License

MIT License

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

logwatch_client-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

logwatch_client-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file logwatch_client-0.1.0.tar.gz.

File metadata

  • Download URL: logwatch_client-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for logwatch_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9933ddcaf730594953d9b85b3cb6de58f02dddc0b0b7323ab596c078e0d6bcd2
MD5 ed2f2c22ca04f7a6fdb8cd28639ce8bf
BLAKE2b-256 2212c7af167e0535b8fabf1ef061e5a144a0834cd00c5ecfd0a32f85ba557154

See more details on using hashes here.

File details

Details for the file logwatch_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: logwatch_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for logwatch_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc9748925f23e4f67595cc1b9e964497940006924206cf6c99c04e9850c7f1c8
MD5 498c972232bc74e3a9b4577ce23459b6
BLAKE2b-256 c943a72404f6255210b5a9a4b30349fca3e858aa6ac822373f8b2d708ef819a0

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