Add per-job hourly log quota enforced on runner#3668
Open
peterschmidt85 wants to merge 2 commits intomasterfrom
Open
Add per-job hourly log quota enforced on runner#3668peterschmidt85 wants to merge 2 commits intomasterfrom
peterschmidt85 wants to merge 2 commits intomasterfrom
Conversation
Prevents runaway log costs by limiting log output per job per calendar hour. Default quota is 50MB/hour, configurable via DSTACK_SERVER_LOG_QUOTA_PER_JOB_HOUR (0 disables). Jobs exceeding the quota are terminated with reason log_quota_exceeded. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DSTACK_SERVER_LOG_QUOTA_PER_JOB_HOURenv var (bytes, 0 disables)errorand reasonlog quota exceededChanges
Go (runner)
types.go: AddTerminationReasonLogQuotaExceededconstantschemas.go: AddLogQuotaHourfield toJobSpeclogs.go: Add quota tracking toappendWriterwith out-of-band signaling via channel (needed because ansistrip is async and swallows downstream errors)executor.go: AddcopyOutputWithQuota()method, wire quota viaSetJob(), handle quota error inRun()executor_test.go: AddTestExecutor_LogQuotaPython (server)
runs.py: AddLOG_QUOTA_EXCEEDEDtoJobTerminationReason(maps toFAILED), addlog_quota_hourtoJobSpecsettings.py: AddSERVER_LOG_QUOTA_PER_JOB_HOURsetting (default 50MB)runner.py: Addlog_quota_hourtoSubmitBodyinclude setbase.py: Add_log_quota_hour()method, wire into_get_job_spec()Test plan
TestExecutor_LogQuotapassesgo test ./...)log quota exceededlog quota exceededdstack ps -vshows statuserrorand errorlog quota exceededdstack logsshows partial logs captured before termination🤖 Generated with Claude Code