> ## Documentation Index
> Fetch the complete documentation index at: https://starforge.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# sf job

> 作业生命周期：日志、状态、停止、暂停续训、批量操作

## 查看

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job ls                     # 作业列表（含提交历史）
sf job status <JOB_ID>        # 状态详情
sf job logs [JOB_ID]          # 跟随日志；省略 ID 跟最近一个
sf job logs <JOB_ID> -n 0     # 回放全量历史再跟随（默认只回放最后 2000 行）
sf job samples <JOB_ID>       # 最近一次验证的多轮对话轨迹
sf job samples <JOB_ID> --vidx 2 -n 10   # 第 3 轮验证，显示 10 条
```

| `logs` 选项    | 说明                               |
| ------------ | -------------------------------- |
| `-n, --tail` | 回放最后 N 行历史再跟随；`-n 0` 全量（默认 2000） |

| `samples` 选项  | 说明                   |
| ------------- | -------------------- |
| `--vidx`      | 验证轮次下标（默认 -1 = 最近一次） |
| `-n, --limit` | 显示样本条数（默认 6）         |

## 控制

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job stop <JOB_ID>          # 停止（运行中 → 终止）
sf job pause <JOB_ID>         # 暂停：保留 checkpoint，可继续
sf job resume <JOB_ID>        # 从最近 checkpoint 自动续训
sf job delete <JOB_ID>        # 删除已结束作业的记录（运行中需先 stop）
```

<Note>
  `pause` / `resume` 是维护友好的暂停语义：管理员维护模式排空集群时作业也走同一条路径，恢复后自动续训不丢进度。
</Note>

## 批量

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job cancel-all             # 停止我所有运行中 / 排队中的作业
sf job clean                  # 清理已结束作业的显示记录
sf job stop-sweep <SWEEP_ID>  # 一键停止一个 sweep 的全部活跃作业
```

## `sf job`

Manage jobs

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job <subcommand>
```

| 命令                  | 说明                                            |
| ------------------- | --------------------------------------------- |
| `sf job cancel-all` | Stop every running or queued job of mine      |
| `sf job clean`      | Clean up the display records of finished jobs |
| `sf job delete`     | Delete one finished job record                |
| `sf job logs`       | Follow a job's logs                           |
| `sf job ls`         | List jobs (including the submission history)  |
| `sf job pause`      | Pause a job, keeping its checkpoint           |
| `sf job resume`     | Resume a paused job                           |
| `sf job retry`      | Retry a failed or stopped job                 |
| `sf job samples`    | Show one validation round's traces            |
| `sf job status`     | Show a job's status                           |
| `sf job stop`       | Stop a job (running -> terminated)            |
| `sf job stop-sweep` | Stop every active job of a sweep              |

### `sf job cancel-all`

Stop every running or queued job of mine

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job cancel-all [options]
```

| 选项            | 说明                    |
| ------------- | --------------------- |
| `--yes`, `-y` | Skip the confirmation |

### `sf job clean`

Clean up the display records of finished jobs

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job clean
```

除 `--help` 外没有其他选项。

### `sf job delete`

Delete one finished job record

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job delete <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job logs`

Follow a job's logs

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job logs [JOB_ID] [options]
```

| 参数       | 说明                                           |
| -------- | -------------------------------------------- |
| `JOB_ID` | Job id (see sf job ls); omitted = the latest |

| 选项                     | 说明                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------- |
| `--tail`, `-n` `<int>` | Replay only the last N log lines before following (default 2000; -n 0 for everything) (默认 `2000`) |

### `sf job ls`

List jobs (including the submission history)

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job ls [options]
```

| 选项                      | 说明                                               |
| ----------------------- | ------------------------------------------------ |
| `--all`                 | Show everything (default: the latest 15)         |
| `--exp`                 | Only this experiment (full name or last segment) |
| `--limit`, `-n` `<int>` | How many to show (ignored with --all) (默认 `15`)  |

### `sf job pause`

Pause a job, keeping its checkpoint

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job pause <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job resume`

Resume a paused job

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job resume <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job retry`

Retry a failed or stopped job

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job retry <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job samples`

Show one validation round's traces

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job samples <JOB_ID> [options]
```

| 参数       | 说明                              |
| -------- | ------------------------------- |
| `JOB_ID` | Job id (see sf job ls) (**必填**) |

| 选项                      | 说明                                                         |
| ----------------------- | ---------------------------------------------------------- |
| `--vidx` `<int>`        | Validation round index (default -1 = the latest) (默认 `-1`) |
| `--limit`, `-n` `<int>` | How many samples to show (默认 `6`)                          |

### `sf job status`

Show a job's status

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job status <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job stop`

Stop a job (running -> terminated)

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job stop <JOB_ID>
```

| 参数       | 说明              |
| -------- | --------------- |
| `JOB_ID` | Job id (**必填**) |

除 `--help` 外没有其他选项。

### `sf job stop-sweep`

Stop every active job of a sweep

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
sf job stop-sweep <SWEEP_ID> [options]
```

| 参数         | 说明                                                    |
| ---------- | ----------------------------------------------------- |
| `SWEEP_ID` | The sweep id (printed when sf sweep submits) (**必填**) |

| 选项            | 说明                    |
| ------------- | --------------------- |
| `--yes`, `-y` | Skip the confirmation |
