Skip to content

Commit e7905cf

Browse files
authored
Use detach less in examples (#1506)
1 parent 988f5f7 commit e7905cf

File tree

6 files changed

+0
-24
lines changed

6 files changed

+0
-24
lines changed

13_sandboxes/anthropic_computer_use.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ def is_server_up(url):
9999
# Note: The sandbox logs may mention `localhost:8080`.
100100
# Ignore this and use the printed tunnel URLs instead.
101101

102-
# After you are done calling methods on the `sandbox` object, we recommend calling `detach` to disconnect
103-
# your local `sandbox` object and clean up any client-side resources.
104-
sandbox.detach()
105-
106102
# When finished, you can terminate the sandbox from your [Modal dashboard](https://modal.com/containers)
107103
# or by running `Sandbox.from_id(sandbox.object_id).terminate()`.
108104
# The Sandbox will also spin down after one hour.

13_sandboxes/jupyter_sandbox.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,5 @@ def is_jupyter_up():
111111

112112
# You can now open this URL in your browser to access the Jupyter notebook!
113113

114-
# After you are done calling methods on the `sandbox` object, we recommend calling `detach` to disconnect
115-
# your local `sandbox` object and clean up any client-side resources.
116-
sandbox.detach()
117-
118114
# When you're done, terminate the sandbox using your [Modal dashboard](https://modal.com/sandboxes)
119115
# or by running `Sandbox.from_id(sandbox.object_id).terminate()`.

13_sandboxes/opencode_server.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ def main(
220220
sandbox = create_sandbox(image, timeout, app, sandbox_secrets, "/root/code")
221221
print_access_info(sandbox, password_secret_name)
222222

223-
# After you are done calling methods on the `sandbox` object, we recommend calling `detach` to disconnect
224-
# your local `sandbox` object and clean up any client-side resources.
225-
sandbox.detach()
226-
227223

228224
# ## Command-line options
229225

13_sandboxes/safe_code_execution.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,3 @@
112112
# Let's terminate the Sandbox to clean up after ourselves.
113113

114114
sandbox.terminate()
115-
116-
# After you are done calling methods on the `sandbox` object, we recommend calling `detach` to disconnect
117-
# your local `sandbox` object and clean up any client-side resources.
118-
sandbox.detach()

13_sandboxes/sandbox_agent.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,3 @@
7575
stderr = claude_ps.stderr.read()
7676
if stderr != "":
7777
print("Agent stderr:", stderr)
78-
79-
# After you are done calling methods on the `sandbox` object, we recommend calling `detach` to disconnect
80-
# your local `sandbox` object and clean up any client-side resources.
81-
sandbox.detach()

13_sandboxes/simple_code_interpreter.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,3 @@ def run_code(writer: modal.io_streams.StreamWriter, reader: Iterator[str], code:
117117
# Finally, let's clean up after ourselves and terminate the Sandbox.
118118

119119
sb.terminate()
120-
121-
# After you are done calling methods on the `sb` object, we recommend calling `detach` to disconnect
122-
# your local `sandbox` object and clean up any client-side resources.
123-
sb.detach()

0 commit comments

Comments
 (0)