Archived
feat(scheduler): add per-level job limits based on load classification
Implements #34 - Job Limits Per Load Level Jobs are now classified into HIGH, MEDIUM, or LOW load levels based on gitignore-style whitelist files (.load files). This allows concurrent execution of different types of jobs (e.g., downloading while transcoding). Changes: - Add LoadLevel enum with default limits (HIGH=2, MEDIUM=8, LOW=32) - Add LoadLevelConfig record for per-level max jobs configuration - Add CommandMatcher sealed interface for matching commands by name/path/dir - Add LoadFileParser for parsing .load whitelist files - Add LoadLevelClassifier for auto-classifying commands - Add ConfigInstallCommand (barn config install) for default config files - Update JobScheduler to use per-level limits with EnumMap - Add --load-level/-l option to barn run for manual override - Add load level display to barn status and barn describe output - Remove --user flag from service install/uninstall (system-wide only) - Update documentation for load levels and whitelist files Default whitelists: - high.load: ffmpeg, ffprobe, handbrake, x264, x265, etc. - low.load: curl, wget, rclone, rsync, aria2c, etc. - medium.load: empty (unmatched commands default to MEDIUM) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5a213788c7
commit
f233547ce8
52 files changed
+2444
-193
No files matched your search
@@ -3,7 +3,8 @@
|
||||
"includes": [
|
||||
{"pattern": "logback.xml"},
|
||||
{"pattern": "version.properties"},
|
||||
{"pattern": "META-INF/.*"}
|
||||
{"pattern": "META-INF/.*"},
|
||||
{"pattern": "defaults/.*"}
|
||||
]
|
||||
},
|
||||
"bundles": []
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Barn Configuration
|
||||
# Generated by: barn config install
|
||||
|
||||
[service]
|
||||
# Logging verbosity: debug, info, warn, error
|
||||
log_level = "info"
|
||||
|
||||
# DEPRECATED: Use [load_levels] section instead
|
||||
# max_concurrent_jobs = 4
|
||||
|
||||
# How often running jobs update their heartbeat (seconds)
|
||||
heartbeat_interval_seconds = 5
|
||||
|
||||
# Heartbeat age before a job is considered orphaned (seconds)
|
||||
stale_heartbeat_threshold_seconds = 30
|
||||
|
||||
[load_levels]
|
||||
# Maximum concurrent high load jobs (CPU/GPU intensive)
|
||||
max_high_jobs = 2
|
||||
|
||||
# Maximum concurrent medium load jobs (general purpose)
|
||||
max_medium_jobs = 8
|
||||
|
||||
# Maximum concurrent low load jobs (network/IO intensive)
|
||||
max_low_jobs = 32
|
||||
|
||||
[jobs]
|
||||
# Maximum time a job can run before being killed (seconds)
|
||||
default_timeout_seconds = 3600
|
||||
|
||||
# Number of retry attempts for failed jobs
|
||||
max_retries = 3
|
||||
|
||||
# Initial delay before first retry (seconds)
|
||||
retry_delay_seconds = 30
|
||||
|
||||
# Multiplier applied to delay after each retry
|
||||
retry_backoff_multiplier = 2.0
|
||||
|
||||
# Only retry on these exit codes (empty = retry all failures)
|
||||
retry_on_exit_codes = []
|
||||
|
||||
[cleanup]
|
||||
# Enable automatic cleanup of old jobs
|
||||
enabled = true
|
||||
|
||||
# Remove jobs older than this (hours)
|
||||
max_age_hours = 72
|
||||
|
||||
# How often the cleanup task runs (minutes)
|
||||
cleanup_interval_minutes = 60
|
||||
|
||||
# Preserve failed jobs for debugging
|
||||
keep_failed_jobs = true
|
||||
|
||||
# How long to keep failed jobs (hours)
|
||||
keep_failed_jobs_hours = 168
|
||||
|
||||
[storage]
|
||||
# Root directory for all Barn data
|
||||
base_dir = "/tmp/barn"
|
||||
|
||||
# Maximum disk space Barn can use (GB)
|
||||
max_disk_usage_gb = 50
|
||||
|
||||
# Keep work/input and work/output after job completion
|
||||
preserve_work_dir = false
|
||||
@@ -0,0 +1,16 @@
|
||||
# High load commands - CPU/GPU intensive (transcoding, encoding)
|
||||
# Maximum concurrent: 2 (default)
|
||||
#
|
||||
# Format:
|
||||
# - Binary name: ffmpeg (matches any path ending with this executable)
|
||||
# - Full path: /usr/local/bin/ffmpeg
|
||||
# - Directory: /opt/encoders/ (trailing slash = match any executable in this directory)
|
||||
|
||||
ffmpeg
|
||||
ffprobe
|
||||
handbrake
|
||||
HandBrakeCLI
|
||||
x264
|
||||
x265
|
||||
av1an
|
||||
svt-av1
|
||||
@@ -0,0 +1,16 @@
|
||||
# Low load commands - Network/IO intensive (downloads, uploads)
|
||||
# Maximum concurrent: 32 (default)
|
||||
#
|
||||
# Format:
|
||||
# - Binary name: curl (matches any path ending with this executable)
|
||||
# - Full path: /usr/local/bin/rclone
|
||||
# - Directory: /opt/downloaders/ (trailing slash = match any executable in this directory)
|
||||
|
||||
curl
|
||||
wget
|
||||
rclone
|
||||
rsync
|
||||
aria2c
|
||||
scp
|
||||
sftp
|
||||
cadaver
|
||||
@@ -0,0 +1,4 @@
|
||||
# Medium load commands
|
||||
# Maximum concurrent: 8 (default)
|
||||
#
|
||||
# Empty by default - unmatched commands are classified as MEDIUM
|
||||
Reference in new issue
Block a user