Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@

import { themes as prismThemes } from 'prism-react-renderer';

function hiddenTargetSidebars(items) {
// hidden not display sidebar
const result = items.filter(item => {
return !(item.type === 'doc' && HiddenSidebars.includes(item.id));
}).map((item) => {
if (item.type === 'category') {
return { ...item, items: hiddenTargetSidebars(item.items) };
}
return item;
});
return result;
}
// 如果需要在sidebar隐藏的话,可以把文档id加到这里,id的命名方式为 路径名/文件名
const HiddenSidebars = ['Getting Started/quickstart', 'References/Python SDK References/python_sdk', 'Release Notes/index']

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

/** @type {import('@docusaurus/types').Config} */
Expand Down Expand Up @@ -48,15 +63,24 @@ const config = {
docs: {
path: "rock",
sidebarPath: './sidebars.js',
sidebarCollapsed: false,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/alibaba/ROCK/tree/master/docs/rock/',
showLastUpdateTime: true,
sidebarItemsGenerator: async ({ defaultSidebarItemsGenerator, ...args }) => {
const sidebarItems = await defaultSidebarItemsGenerator(args);
return hiddenTargetSidebars(sidebarItems);
},
},
theme: {
customCss: './src/css/custom.css',
},
gtag: {
trackingID: 'G-26LMNFB70V',
anonymizeIP: true,
},
}),
],
],
Expand Down Expand Up @@ -120,8 +144,12 @@ const config = {
title: 'Docs',
items: [
{
label: 'overview',
to: '/ROCK/docs/overview',
label: 'Overview',
to: '/docs/overview',
},
{
label: 'Quick Start',
to: '/docs/Getting%20Started/quickstart',
},
],
},
Expand Down
24 changes: 20 additions & 4 deletions docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@
"message": "Next",
"description": "The label for version current"
},
"sidebar.tutorialSidebar.category.CN": {
"message": "CN",
"description": "The label for category 'CN' in sidebar 'tutorialSidebar'"
"sidebar.tutorialSidebar.category.Getting Started": {
"message": "快速上手",
"description": "The label for category 'Getting Started' in sidebar 'tutorialSidebar'"
},
"sidebar.tutorialSidebar.category.User Guides": {
"message": "用户指南",
"description": "The label for category 'User Guides' in sidebar 'tutorialSidebar'"
},
"sidebar.tutorialSidebar.category.References": {
"message": "参考",
"description": "The label for category 'References' in sidebar 'tutorialSidebar'"
},
"sidebar.tutorialSidebar.category.Release Notes": {
"message": "版本说明",
"description": "The label for category 'Release Notes' in sidebar 'tutorialSidebar'"
},
"sidebar.tutorialSidebar.category.Python SDK References": {
"message": "Python SDK 参考",
"description": "The label for category 'Python SDK References' in sidebar 'tutorialSidebar'"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@
sidebar_position: 2
---

# 快速开始
# 快速上手

本指南将通过完整的示例演示如何使用 ROCK 创建和管理强化学习环境。ROCK (Reinforcement Open Construction Kit) 是一个全面的沙箱环境管理框架,主要用于强化学习和AI开发环境。

## 目录

1. [环境准备](#1-环境准备)
- [系统要求](#11-系统要求)
- [验证依赖安装](#12-验证依赖安装)
- [项目初始化](#13-项目初始化)
2. [激活虚拟环境](#2-激活虚拟环境)
3. [验证环境配置](#3-验证环境配置)
4. [启动 ROCK 服务](#4-启动-rock-服务)
5. [运行示例环境](#5-运行示例环境)
- [示例说明](#51-示例说明)
6. [分布式环境配置(可选)](#6-分布式环境配置可选)
7. [MacOS 启动](#7-macos启动)
8. [从Pip源启动](#8-从pip源启动)
- [快速上手](#快速上手)
- [目录](#目录)
- [1. 环境准备](#1-环境准备)
- [1.1 系统要求](#11-系统要求)
- [1.2 验证依赖安装](#12-验证依赖安装)
- [1.3 项目初始化](#13-项目初始化)
- [2. 激活虚拟环境](#2-激活虚拟环境)
- [3. 验证环境配置](#3-验证环境配置)
- [4. 启动 ROCK 服务](#4-启动-rock-服务)
- [5. 运行示例环境](#5-运行示例环境)
- [5.1 示例说明](#51-示例说明)
- [6. 分布式环境配置(可选)](#6-分布式环境配置可选)
- [7. MacOS 启动](#7-macos-启动)
- [8. 从Pip源启动](#8-从pip源启动)
- [总结](#总结)
- [下一步学习](#下一步学习)

## 1. 环境准备

Expand Down Expand Up @@ -152,12 +156,12 @@ export ROCK_WORKER_ENV_TYPE=uv

在容器启动时,会安装对应的 uv 环境,细节可以参考 `rock/rocklet/docker_run_with_uv.sh` 脚本。

> **注意**: 相比 Linux 系统,macOS 上的启动速度会较慢,且比较依赖网络环境,可以根据实际情况调整脚本。ROCK_WORKER_ENV_TYPE的细节可以参考 [Configuration Guide](configuration.md).
> **注意**: 相比 Linux 系统,macOS 上的启动速度会较慢,且比较依赖网络环境,可以根据实际情况调整脚本。ROCK_WORKER_ENV_TYPE的细节可以参考 [Configuration Guide](../User%20Guides/configuration.md).


## 8. 从Pip源启动

如果从Pip源启动Admin Server,在参照[installation.md](installation.md)安装完成ROCK后, 需要设置额外环境变量:
如果从Pip源启动Admin Server,在参照[installation.md](./installation.md)安装完成ROCK后, 需要设置额外环境变量:

```bash
export ROCK_WORKER_ENV_TYPE=pip
Expand All @@ -180,8 +184,8 @@ export ROCK_WORKER_ENV_TYPE=pip

## 下一步学习

- [配置指南](configuration.md) - 详细了解 ROCK 的配置选项
- [API 文档](api.md) - 查看完整的 API 接口
- [SDK 文档](sdk.md) - 学习如何使用 Python SDK 进行开发
- [安装指南](installation.md) - 详细了解 ROCK 安装和配置
- [概述](overview.md) - 了解 ROCK 的整体架构和设计理念
- [配置指南](../User%20Guides/configuration.md) - 详细了解 ROCK 的配置选项
- [API 文档](../References/api.md) - 查看完整的 API 接口
- [Python SDK 文档](../References/Python%20SDK%20References/python_sdk.md) - 学习如何使用 Python SDK 进行开发
- [安装指南](./installation.md) - 详细了解 ROCK 安装和配置
- [概述](../overview.md) - 了解 ROCK 的整体架构和设计理念
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ bash examples/agentic_demo/run_agentic_pipeline_sokoban_sandbox_multi_nodes.sh
### 进阶:分布式 ROLL 训练

如果您希望将 ROLL 训练任务本身进行分布式部署,可以参考 ROLL 的官方分布式部署文档。
> [快速上手:多节点部署指南](https://alibaba.github.io/ROLL/zh-Hans/docs/QuickStart/multi_nodes_quick_start)
> [快速上手:多节点部署指南](https://alibaba.github.io/ROLL/zh-Hans/docs/Getting%20Started/Quick%20Start/multi_nodes_quick_start)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 2
---

# Python SDK 参考
Expand All @@ -8,13 +8,16 @@ sidebar_position: 6

## 目录

1. [概述](#1-概述)
2. [Sandbox SDK](#2-sandbox-sdk)
- [基本沙箱操作](#21-基本沙箱操作)
- [沙箱组管理](#22-沙箱组管理)
- [配置示例](#23-配置示例)
3. [GEM SDK](#3-gem-sdk)
- [Python SDK 方式](#31-python-sdk-方式)
- [Python SDK 参考](#python-sdk-参考)
- [目录](#目录)
- [1. 概述](#1-概述)
- [2. Sandbox SDK](#2-sandbox-sdk)
- [2.1 基本沙箱操作](#21-基本沙箱操作)
- [3.2 沙箱组管理](#32-沙箱组管理)
- [相关文档](#相关文档)
- [3.3 配置示例](#33-配置示例)
- [4. GEM SDK](#4-gem-sdk)
- [4.1 Python SDK 方式](#41-python-sdk-方式)

## 1. 概述

Expand Down Expand Up @@ -95,10 +98,10 @@ await sandbox_group.stop()

## 相关文档

- [快速开始指南](quickstart.md) - 了解如何快速开始使用 ROCK SDK
- [API 文档](api.md) - 查看 SDK 封装的底层 API 接口
- [配置指南](configuration.md) - 了解 SDK 相关的配置选项
- [安装指南](installation.md) - 详细了解 ROCK 安装和配置
- [快速开始指南](../../Getting%20Started/quickstart.md) - 了解如何快速开始使用 ROCK SDK
- [API 文档](../api.md) - 查看 SDK 封装的底层 API 接口
- [配置指南](../../User%20Guides/configuration.md) - 了解 SDK 相关的配置选项
- [安装指南](../../Getting%20Started/installation.md) - 详细了解 ROCK 安装和配置

### 3.3 配置示例

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Sandbox SDK 参考

## `arun`
`arun()` 方法新增 `response_limited_bytes_in_nohup` 参数(int型),解决response过长导致的请求超时问题。
该参数用于限制 nohup 模式下返回的 output 字符数,默认值为 `None`,表示不限制。

```python
from rock.sdk.sandbox.client import Sandbox
from rock.sdk.sandbox.config import SandboxConfig
from rock.sdk.sandbox.request import CreateBashSessionRequest

config = SandboxConfig(
image=f"{image}",
xrl_authorization=f"{xrl_authorization}",
user_id=f"{user_id}",
cluster=f"{cluster}",
)
sandbox = Sandbox(config)

session = sandbox.create_session(
CreateBashSessionRequest(
session="bash-1",
response_limited_bytes_in_nohup=1024
)
)

# 返回的数据最多只有1024个字符
resp = asyncio.run(
sandbox.arun(
cmd="cat /tmp/test.txt",
mode="nohup",
session="bash-1",
)
)
```

## `read_file_by_line_range`
功能说明: 按行范围异步读取文件内容,支持自动分块读取和会话管理。主要特性包括大文件自动分块读取、自动统计文件总行数、内置重试机制(3次重试)、参数验证。以下是使用示例:
```python
# 读取整个文件
response = await read_file_by_line_range("example.txt")

# 读取指定行范围
response = await read_file_by_line_range("example.txt", start_line=1, end_line=2000)
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 1
---

# API 参考
Expand All @@ -8,7 +8,7 @@ sidebar_position: 5

## 目录

- [ROCK API 文档](#rock-api-文档)
- [API 参考](#api-参考)
- [目录](#目录)
- [1. 概述](#1-概述)
- [2. Sandbox API](#2-sandbox-api)
Expand Down Expand Up @@ -108,10 +108,10 @@ GEM环境交互功能:

## 相关文档

- [快速开始指南](quickstart.md) - 了解如何快速开始使用 ROCK API
- [SDK 文档](sdk.md) - 学习如何使用 SDK 调用 API
- [配置指南](configuration.md) - 了解 API 相关的配置选项
- [安装指南](installation.md) - 详细了解 ROCK 安装和配置
- [快速开始指南](../Getting%20Started/quickstart.md) - 了解如何快速开始使用 ROCK API
- [Python SDK 文档](./Python%20SDK%20References/python_sdk.md) - 学习如何使用 SDK 调用 API
- [配置指南](../User%20Guides/configuration.md) - 了解 API 相关的配置选项
- [安装指南](../Getting%20Started/installation.md) - 详细了解 ROCK 安装和配置


## 4. HTTP API 使用示例
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sidebar_position: 1
---
# 版本说明
* [release v0.1.7.3](v0.1.7.3.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# V0.1.7.3

## 更新日期
2025.11.19

## SDK
### New Features
* `Sandbox.arun()` 方法新增: `response_limited_bytes_in_nohup` 参数,解决response过长导致的请求超时问题。具体参考[Sandbox SDK 参考](../References/Python%20SDK%20References/sandbox.md)
* `Sandbox`新增`read_file_by_line_range`方法, 解决Sandbox.read_file方法不支持读取超过1000行文件的问题. 需要注意该方法无法保证与原始文件内容完全一致,可能会丢失换行符或其他信息, 请谨慎使用。具体参考[Sandbox SDK 参考](../References/Python%20SDK%20References/sandbox.md)

### Upgrades
* Wheel包依赖项优化,降低与其他项目的冲突概率
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 4
---

# 配置
# 配置指南

本指南详细介绍如何配置 ROCK 环境以满足不同的使用需求,包括本地开发、测试和生产部署。

Expand Down Expand Up @@ -189,7 +189,7 @@ echo $ROCK_PROJECT_ROOT

## 相关文档

- [快速开始指南](quickstart.md) - 了解如何快速搭建 ROCK 环境
- [API 文档](api.md) - 查看沙箱相关的 API 接口
- [SDK 文档](sdk.md) - 学习如何使用 SDK 配置沙箱
- [安装指南](installation.md) - 详细了解 ROCK 安装和配置
- [快速开始指南](../Getting%20Started/quickstart.md) - 了解如何快速搭建 ROCK 环境
- [API 文档](../References/api.md) - 查看沙箱相关的 API 接口
- [Python SDK 文档](../References/Python%20SDK%20References/python_sdk.md) - 学习如何使用 SDK 配置沙箱
- [安装指南](../Getting%20Started/installation.md) - 详细了解 ROCK 安装和配置
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ROCK (Reinforcement Open Construction Kit) 是一个开源的强化学习环境

## 目录

- [ROCK 概述](#rock-概述)
- [概览](#概览)
- [目录](#目录)
- [什么是 ROCK](#什么是-rock)
- [ROCK 的核心功能](#rock-的核心功能)
Expand Down Expand Up @@ -37,20 +37,20 @@ ROCK 为不同角色的工程师提供了显著价值:

## 了解更多

- [快速开始指南](quickstart.md) - 快速上手 ROCK
- [配置指南](configuration.md) - 详细了解 ROCK 的配置选项
- [API 文档](api.md) - 查看 ROCK 提供的 API 接口
- [SDK 文档](sdk.md) - 学习如何使用 ROCK 的 Python SDK
- [安装指南](installation.md) - 详细了解 ROCK 安装和配置
- [快速开始指南](./Getting%20Started/quickstart.md) - 快速上手 ROCK
- [配置指南](./User%20Guides/configuration.md) - 详细了解 ROCK 的配置选项
- [API 文档](./References/api.md) - 查看 ROCK 提供的 API 接口
- [Python SDK 文档](./References/Python%20SDK%20References/python_sdk.md) - 学习如何使用 ROCK 的 Python SDK
- [安装指南](./Getting%20Started/installation.md) - 详细了解 ROCK 安装和配置

## 相关文档

如果您是第一次使用 ROCK,建议按以下顺序阅读文档:
1. [快速开始指南](quickstart.md) - 快速搭建开发环境
2. [配置指南](configuration.md) - 配置您的 ROCK 环境
3. [SDK 文档](sdk.md) - 学习如何使用 Python SDK 进行开发
4. [API 文档](api.md) - 了解完整的 API 接口
5. [安装指南](installation.md) - 详细了解 ROCK 安装和配置
1. [快速开始指南](./Getting%20Started/quickstart.md) - 快速搭建开发环境
2. [配置指南](./User%20Guides/configuration.md) - 配置您的 ROCK 环境
3. [Python SDK 文档](./References/Python%20SDK%20References/python_sdk.md) - 学习如何使用 Python SDK 进行开发
4. [API 文档](./References/api.md) - 了解完整的 API 接口
5. [安装指南](./Getting%20Started/installation.md) - 详细了解 ROCK 安装和配置



Expand Down
Loading
Loading