Before you begin
샌드박스 설정을 완료하세요. Python 예시를 실행하려면wandb extra를 포함한 cwsandbox 패키지를 설치하고, WANDB_API_KEY 환경 변수에 W&B API 키를 설정해야 합니다. [WANDB-API-KEY]를 본인의 W&B API 키로 바꾸세요.
Choose a lifetime
The lifetime is an upper bound on how long the sandbox can run. The platform terminates it when the lifetime expires, even if work is still in progress. A workload that finishes or a sandbox that you stop can end sooner.
An explicit lifetime takes precedence over a runner-policy default. If you omit the lifetime, the platform uses the applicable policy default. If no positive default supplies a lifetime, the platform uses 10 minutes (600 seconds). Set the lifetime explicitly for long-running work instead of relying on a default.
플랫폼은 30일을 초과하는 요청을 거부합니다. 값을
0으로 지정해도 실행 시간이 무제한이 되는 것은 아닙니다.
You can’t extend the lifetime after a sandbox starts. Choose enough time at creation, and plan to save your work before the deadline.
Set the lifetime when creating a sandbox
Python에서는max_lifetime_seconds를 사용하세요. 다음 예시는 30일 전체를 요청하고, 나중에 다시 연결할 수 있도록 샌드박스 ID를 출력합니다:
Create a Serverless sandbox
sleep infinity and leave the sandbox running after the script exits. When you finish using the sandbox, stop it.
The same lifetime is available through the other client interfaces:
요청 형식은 Compose 파일로 샌드박스 생성하기를 참조하세요. Python 클라이언트의 기본값은 샌드박스 설정을 참조하세요.
Keep working across client sessions
When a sandbox should outlive the Python script that launches it, create a standalone sandbox, as in the preceding examples. Awith Sandbox.run(...) context stops the sandbox when the block exits, even if its configured lifetime is 30 days. A Session also manages cleanup of the sandboxes it owns. See Cleanup patterns.
To reconnect from another script, replace [SANDBOX-ID] with the ID printed at creation:
Reconnect to a running sandbox
Connected. Reconnecting doesn’t reset the lifetime. When you finish, stop the sandbox explicitly:
Stop a sandbox
Plan for expiry
샌드박스 수명이 만료되기 전에 결과나 체크포인트를 샌드박스 외부에 저장하세요. 워크플로가 30일을 넘게 걸리는 경우에는 대체 샌드박스를 생성한 뒤 저장된 상태에서 재개하세요. 지원되는 저장소 및 스냅샷 옵션은 샌드박스 볼륨 및 파일 시스템 스냅샷을 참조하세요. The sandbox lifetime is separate from the timeout for a command or API request. Increasingtimeout_seconds or request_timeout_seconds doesn’t extend the sandbox lifetime. For the differences, see Timeouts.