跳到主要内容

Sandbox 命令:sandbox

Sandbox 提供隔离的远程环境,用于交互式开发、命令执行、文件访问和可复用镜像。

命令

命令用法说明
connectbohr sandbox connect <sandbox_id> [flags]解析 Sandbox 的数据面连接
createbohr sandbox create [template] [flags]创建 Sandbox
deletebohr sandbox delete <sandbox_id>... [flags]删除一个或多个 Sandbox(破坏性操作)
describebohr sandbox describe <sandbox_id> [flags]查看 Sandbox 详情
doctorbohr sandbox doctor [flags]检查环境是否就绪
execbohr sandbox exec <sandbox_id> [command...] [flags]在 Sandbox 中执行命令
filesbohr sandbox files [command]管理 Sandbox 中的文件
imagebohr sandbox image [command]构建和管理 Sandbox 镜像
listbohr sandbox list [flags]列出 Sandbox
machinebohr sandbox machine [command]浏览 Sandbox 机型规格
psbohr sandbox ps <sandbox_id> [flags]列出 Sandbox 中的进程
quotabohr sandbox quota [flags]查看 Sandbox、模板与临时存储的配额和用量
templatebohr sandbox template [command]管理 Sandbox 模板
terminalbohr sandbox terminal [command]管理 Sandbox 内的 PTY 终端会话

命令组内的子命令请运行 bohr sandbox <组> --help 查看。

常用参数

参数说明
-t, --template <name>Sandbox 模板名称
--gpu[=4090\|5090\|l20]快速选择 GPU 模板;单独使用 --gpu 时选择 4090
--project-id <id>将 Sandbox 关联到项目
--timeout <seconds>自动删除超时时间,默认 12 小时
--never-timeout禁用自动超时
--env <KEY=VALUE>设置环境变量,可重复使用
-c, --command <command>sandbox exec 执行的命令
--background后台运行 exec 命令并返回其 PID

示例

bohr sandbox machine list --choose-type gpu --sort price
bohr sandbox create --gpu=l20 --project-id 123 --timeout 7200
bohr sandbox exec 456 --command "python /bohr-workspace/main.py"
bohr sandbox files read 456 /bohr-workspace/result.json --destination ./result.json
bohr sandbox quota
bohr sandbox doctor

创建 Sandbox、构建或提交镜像可能产生费用。删除 Sandbox 是破坏性操作,使用 --force 前请先检查运行中的进程。