Keep a sandbox longer, pause it with its files and processes, resume it, and fork it into copies.
Status
| Status | Meaning |
|---|---|
pending | The sandbox starts, or a persistent sandbox resumes. |
running | The sandbox runs commands. |
paused | A persistent sandbox keeps its files and processes, and runs nothing. |
stopped | The sandbox ended. |
failed | The sandbox did not start, or an error stopped it. |
Timeout
A sandbox stops at the first of these events. end_reason tells which event it was:
timeout: its timeout ends.expires_atgives the time.deleted: you delete it.credits: the free time and the credits of your organization are used up.error: an error stops it.
To keep a sandbox longer:
- Send a new
timeoutin seconds toPOST /sandboxes/{sandbox_id}/timeout. - The timeout counts from the create, or from the last change.
- A command does not change the timeout.
When a sandbox stops, its processes and files are gone. GET /sandboxes still shows its record.
Pause and resume
A persistent sandbox keeps its files and processes when it pauses. A pause saves its memory and its disk, and stops its machine. A resume starts it again with the same files, processes and data in memory.
- Create the sandbox with
"persistent": true. - Pause it with
POST /sandboxes/{sandbox_id}/pause. - Resume it with
POST /sandboxes/{sandbox_id}/resume, and give a newtimeout.
curl -sS --fail-with-body https://api.munito.ai/sandboxes/v1/sandboxes \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"size": "default", "persistent": true}'
curl -sS --fail-with-body -X POST "https://api.munito.ai/sandboxes/v1/sandboxes/$SANDBOX/pause" \
-H "Authorization: Bearer $MUNITO_API_KEY"
curl -sS --fail-with-body "https://api.munito.ai/sandboxes/v1/sandboxes/$SANDBOX/resume" \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"timeout": 3600}'- The timeout of a persistent sandbox pauses it. It does not stop it.
- A paused sandbox pays no machine time. Its saved state pays a storage price.
- Open network connections stop at a pause. The programs must open them again.
- A paused sandbox stops 30 days after its pause, and its saved state is deleted.
- A delete of a paused sandbox deletes its saved state at once.
Fork
A fork starts new sandboxes from a persistent sandbox, as it is now:
curl -sS --fail-with-body "https://api.munito.ai/sandboxes/v1/sandboxes/$SANDBOX/fork" \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"count": 4, "timeout": 600}'- A running sandbox stops for a moment, and then continues. A paused sandbox stays paused.
- Each new sandbox is persistent, unless you set
"persistent": false. Munito AI bills each new sandbox separately. - The answer lists the new sandboxes. All of them start, or none of them starts.
- A fork starts 16 sandboxes or less.