Add per-job data transfer quota (AWS)#3685
Open
peterschmidt85 wants to merge 3 commits intomasterfrom
Open
Conversation
…limits Adds a configurable per-job outbound data transfer quota (AWS only) that terminates jobs when the total external traffic exceeds the threshold. Metering uses iptables byte counters on the shim (host-level), excluding private/VPC traffic. The shim notifies the runner via a new /api/terminate endpoint so the server reads the termination reason through the existing /api/pull flow — same pattern as log quota. Configured via DSTACK_SERVER_DATA_TRANSFER_QUOTA_PER_JOB_AWS (bytes, 0=unlimited). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…uota Co-Authored-By: Claude Opus 4.6 (1M context) <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_DATA_TRANSFER_QUOTA_PER_JOB_AWSserver setting (bytes, 0=unlimited) to terminate jobs exceeding outbound data transfer limitsPOST /api/terminateendpoint, so the server reads the termination reason through the existing/api/pullflow (same pattern as log quota)data_transfer_quota_exceededtermination reason, visible in CLI and UIDSTACK_SERVER_DATA_TRANSFER_QUOTA_PER_JOB_GCP, etc.Files changed
Go (shim/runner):
runner/internal/shim/netmeter/— new package: iptables chain setup, byte counter polling, quota checkrunner/internal/shim/docker.go—waitContainerWithQuota()method wired intoRun()runner/internal/runner/api/— newPOST /api/terminateendpointrunner/internal/common/types/types.go—TerminationReasonDataTransferQuotaExceededPython (server):
settings.py—SERVER_DATA_TRANSFER_QUOTA_PER_JOB_AWSenv varruns.py—DATA_TRANSFER_QUOTA_EXCEEDEDtermination reasonjobs_running.py/running_jobs.py— pass quota to shim for AWS backendTest plan
netmeter_test.go)Error (Data transfer quota exceeded)indstack ps🤖 Generated with Claude Code