Add process usage monitoring for each Job #23

Closed
opened 2026-10-04 19:28:29 +00:00 by daniel · 1 comment
Owner

Imported from GitHub samson-media/barn#23 — opened by @daniel-samson on 2026-01-21 15:52:55 UTC

It would be useful to monitor who much resources each job is using:

  • CPU usage as a percentage
  • Memory usage in bytes
  • Hard usage in bytes of the /tmp
  • GPU usage as a percentage (if available)
  • GPU Memory usage in bytes (if available)

This usage would be stored in /tmp as a log in the job folder. it should be stored a csv format with a timestamp as the first column.

this can be accessed via a new command barn usage {job id}

<!-- github-import:issue:23 --> _Imported from GitHub samson-media/barn#23 — opened by **@daniel-samson** on 2026-01-21 15:52:55 UTC_ It would be useful to monitor who much resources each job is using: - CPU usage as a percentage - Memory usage in bytes - Hard usage in bytes of the /tmp - GPU usage as a percentage (if available) - GPU Memory usage in bytes (if available) This usage would be stored in /tmp as a log in the job folder. it should be stored a csv format with a timestamp as the first column. this can be accessed via a new command `barn usage {job id}`
Author
Owner

@daniel-samson commented on 2026-01-21 16:23:13 UTC:

Implemented process usage monitoring:

New Components:

  • UsageRecord - Record for holding usage metrics (CPU, memory, disk, GPU)
  • UsageCollector - Collects metrics using OS-specific commands (ps, wmic, nvidia-smi)
  • UsageLogger - Thread-safe CSV writer for usage.csv
  • UsageMonitor - Scheduled executor sampling every 5 seconds
  • UsageCommand - CLI command barn usage <job-id>

CLI Options:

  • --limit N - Limit to last N samples
  • --csv - Export raw CSV data
  • --summary - Show summary statistics only
  • --output json|xml - Output format

Integration:

  • JobRunner automatically starts/stops monitoring during job execution

Tests:

  • 65 new tests across 5 test classes

Documentation:

  • Updated docs/jobs.md with usage monitoring section
<!-- github-import:comment:3779363246 --> _**@daniel-samson** commented on 2026-01-21 16:23:13 UTC:_ Implemented process usage monitoring: **New Components:** - `UsageRecord` - Record for holding usage metrics (CPU, memory, disk, GPU) - `UsageCollector` - Collects metrics using OS-specific commands (ps, wmic, nvidia-smi) - `UsageLogger` - Thread-safe CSV writer for usage.csv - `UsageMonitor` - Scheduled executor sampling every 5 seconds - `UsageCommand` - CLI command `barn usage <job-id>` **CLI Options:** - `--limit N` - Limit to last N samples - `--csv` - Export raw CSV data - `--summary` - Show summary statistics only - `--output json|xml` - Output format **Integration:** - JobRunner automatically starts/stops monitoring during job execution **Tests:** - 65 new tests across 5 test classes **Documentation:** - Updated docs/jobs.md with usage monitoring section
This repo is archived. You cannot comment on issues.