-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds filtering sandboxes by state in the SDKs #564
base: beta
Are you sure you want to change the base?
Changes from 1 commit
6504900
039b7a3
33f2c07
60a75a8
1f95e44
8c096b1
a90ebc4
76d8a94
5e1c6ab
d688463
6bc1c1b
8b48134
5f0c179
fe1ffa7
5803a4f
1898417
20bb345
a8ec896
f58ad17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,6 @@ console.log('Paused sandboxes', sandboxes) | |
``` | ||
```python | ||
from e2b import Sandbox | ||
|
||
# or use Core: https://github.com/e2b-dev/e2b | ||
# from e2b import Sandbox | ||
# | ||
|
@@ -159,6 +158,48 @@ print('Paused sandboxes', sandboxes) | |
``` | ||
</CodeGroup> | ||
|
||
## 5. Removing paused sandboxes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is js and python little bit different, also could you unify word There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give me an example? |
||
|
||
You can remove paused (and running!) sandboxes by calling the `kill` method on the Sandbox instance. | ||
|
||
<CodeGroup> | ||
```js | ||
import { Sandbox } from '@e2b/code-interpreter' | ||
// or use Core: https://github.com/e2b-dev/e2b | ||
// import { Sandbox } from 'e2b' | ||
// | ||
// or use Desktop: https://github.com/e2b-dev/desktop | ||
// import { Sandbox } from '@e2b/desktop' | ||
|
||
const sbx = await Sandbox.create() | ||
console.log('Sandbox created', sbx.sandboxId) | ||
|
||
// Pause the sandbox | ||
// You can save the sandbox ID in your database | ||
// to resume the sandbox later | ||
const sandboxId = await sbx.pause() | ||
|
||
// Remove the sandbox | ||
await sbx.kill() | ||
``` | ||
```python | ||
from e2b import Sandbox | ||
# or use Core: https://github.com/e2b-dev/e2b | ||
# from e2b import Sandbox | ||
# | ||
# or use Desktop: https://github.com/e2b-dev/desktop | ||
# from e2b_desktop import Sandbox | ||
|
||
sbx = Sandbox() | ||
|
||
# Pause the sandbox | ||
sandbox_id = sbx.pause() | ||
|
||
# Remove the sandbox | ||
sbx.kill() | ||
``` | ||
</CodeGroup> | ||
|
||
## Sandbox's timeout | ||
When you resume a sandbox, the sandbox's timeout is reset to the default timeout of an E2B sandbox - 5 minutes. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mishushakov will deleting paused sandboxes be included in a separate PR? I'm asking because the new docs addition doesn't mention anything about deleting paused sandboxes.
Other than that, this looks good to me on the docs level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this will be a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I have decided to add it here as well to avoid merge conflicts