runwhere CLI
完整命令参考
runwhere CLI 的核心命令、常用命令、高级命令和全局选项。
全局选项
| 选项 | 说明 |
|---|---|
--help | 显示帮助信息。 |
--version | 显示 CLI 版本。 |
--json | 输出结构化 JSON,适合脚本和 CI。 |
--explain | 显示平台默认值填充过程,主要用于 submit 排查。 |
全局选项写在子命令前:
runwhere --json get jobs
runwhere --explain submit -f train.yaml--json 输出示例:
{"data": [{"id": "job-efa79e36", "job_id": "job-efa79e36", "name": "claude-cli-docs-verify", "job_type": "training", "platform": "aliyun", "status": "running", "url": null, "gpu_count": 1, "sku_key": "ecs.gn7i.2xlarge", "offer_key": "aliyun/cn-hangzhou/cn-hangzhou-i/on_demand/ecs.gn7i.2xlarge", "node_id": "node-1f661ea4", "price_per_hour": "36.4400", "estimated_cost": "0.0000", "final_cost": null, "billed_seconds": 0, "created_at": "2026-07-25T00:24:38+00:00", "started_at": null, "ended_at": null}], "total": 1}认证
| 命令 | 说明 |
|---|---|
runwhere login --endpoint <url> | 登录并缓存 endpoint/token。 |
runwhere whoami | 显示当前用户、组织和 workspace 地址。 |
runwhere logout | 清除本机登录凭证(endpoint 保留;不吊销 API Key)。 |
runwhere ssh-key setup | 生成本机 SSH 密钥并注册公钥(幂等;login 后自动执行,通常无需手动跑)。 |
非交互登录:
echo "$RUNWHERE_TOKEN" | runwhere login --endpoint https://api.runwhere.cn核心命令
| 命令 | 说明 |
|---|---|
runwhere sync -f <yaml> | 增量同步代码,并准备环境和模型。 |
runwhere sync -f <yaml> --status | 查看最近一次同步状态。 |
runwhere submit -f <yaml> | 提交 Training、Inference 或 Notebook。 |
runwhere logs <job> | 查看历史日志。 |
runwhere logs <job> -f | 实时跟随日志和平台事件。 |
runwhere ssh <job> | SSH 到算力节点(默认进机器;-c 进任务容器)。 |
价格命令
| 命令 | 说明 |
|---|---|
runwhere price summary | GPU 型号、价格范围和库存概览。 |
runwhere price list <GPU 型号> | 指定 GPU 的 SKU 列表(按价格升序,默认前 20)。型号含空格需引号,如 runwhere price list "Ascend 310"。 |
runwhere price list <型号> --gpu-type <type> | 位置参数与 --gpu-type 二选一。 |
runwhere price list <型号> --provider <name> | 按厂商筛选。 |
runwhere price list <型号> --billing-model <model> | 按计费模式筛选。 |
runwhere price list <型号> --limit <n> / --all | 显示条数调整 / 显示全部(默认 20)。 |
runwhere price recommend -f <yaml> | 基于 YAML 推荐资源方案。 |
runwhere price recommend -f <yaml> --top <n> | 控制推荐数量。 |
runwhere price recommend -f <yaml> --no-spot | 不使用竞价资源。 |
runwhere price recommend -f <yaml> --max-price <price> | 设置最高预算,单位元/小时。 |
作业管理
<job> 均接受任务 ID(job-xxxx,系统唯一、荐用)或任务名称(同名多条时取最新活跃一条)。
| 命令 | 说明 |
|---|---|
runwhere get jobs | 列出作业(默认最近 20 条,--all 全量;列与控制台一致)。 |
runwhere get jobs --limit <n> | 只显示最近 n 条(显示层截断)。 |
runwhere get jobs --status running | 按状态筛选(running/provisioning/suspended/stopped/failed)。 |
runwhere get jobs --kind Training | 按类型筛选。 |
runwhere describe job <job> | 查看作业详情(字段与控制台任务详情一致)。 |
runwhere stop job <job> | 停止作业并释放计算资源。 |
runwhere resume <job> | 恢复训练或 Notebook。 |
runwhere resume <job> --from-step <n> | 从指定训练 step 恢复。 |
runwhere delete job <job> | 删除作业记录。 |
runwhere delete job <job> --force | 强制删除运行中的作业记录。 |
节点访问(SSH)
SSH 直连作业所在的算力节点,用于查看 GPU 状态、排查环境或直接在任务环境里工作。
runwhere ssh <job> # 进机器(宿主机 shell——nvidia-smi、磁盘、进程排查)
runwhere ssh <job> -c # 进任务容器(训练 / Notebook 实际运行的环境)- 默认进机器:训练、推理、Notebook 行为一致;
-c才进任务容器。 - 密钥零配置:
runwhere login后自动生成本机密钥(~/.runwhere/id_ed25519) 并注册公钥。私钥只保存在你自己的电脑上,平台与节点仅持有公钥;节点密码登录 已禁用,只有注册过公钥的钥匙能进。 - 仅运行期间可用:节点开机中会明确提示等待;任务结束后节点释放,历史节点
信息(云/区域/规格/IP)在
runwhere describe job和控制台任务详情"算力节点"中查看。 - 控制台任务详情的"算力节点"卡片可直接复制这两条命令。
密钥机制与 ssh-key setup 说明见 SSH 访问节点 专页。
用量
| 命令 | 说明 |
|---|---|
runwhere get usage | 查看当前周期用量。 |
runwhere get usage --from YYYY-MM-DD --to YYYY-MM-DD | 查看指定日期范围。 |
退出码
| 退出码 | 含义 |
|---|---|
0 | 成功。 |
2 | 用户输入错误,例如 YAML 文件不存在或参数错误。 |
3 | 服务端错误,例如未登录、认证失败或 API 返回错误。 |
4 | 网络错误,例如连接超时或 DNS 失败。 |
1 | 其他错误。 |
日常工作流
runwhere login --endpoint https://api.runwhere.cn
runwhere whoami
runwhere price recommend -f train.yaml --top 3
runwhere sync -f train.yaml
runwhere submit -f train.yaml
runwhere logs <name> -f
runwhere get jobs
runwhere describe job <name>
runwhere stop job <name>
runwhere delete job <name>