Conversation
Implements CON-1523, CON-1524, CON-1525, and CON-1526. Based on REST migration PR #584. Keep this draft local until that PR is merged. Includes managed ownership, bounded startup handling, closeable SSE streams, and cancellation-safe synchronous and asynchronous resource cleanup.
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.
This brings sandbox support to the Python SDK, with a regular
SandboxAPI and an asyncAsyncioSandboxAPI. Both share the same lifecycle and execution logic.use a context manager for a short-lived sandbox:
The async version works the same way:
To work with a sandbox that's already running, use
get(sandbox_id)orlist(...). Those handles only close their local connections when you leave the context. they don't terminate the sandbox. You can callterminate()explicitly when you're finished with it.exec()returns command output, andcheck=Trueraises on command failure while keeping any partial output.logs()streams container or system logs and supports resuming with an event'sidthroughlast_event_id. Use a context manager around the log stream too if you might stop reading early.While working on this, I discovered an edge case in log streaming on host that should be addressed as well: CON-1557 / runpod/host#2820.
Linear: CON-1523, CON-1524, CON-1525, CON-1526