dsh-scnet 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -113
- package/README_CN.md +20 -1
- package/docs/installation.md +10 -0
- package/docs/installation.zh-CN.md +13 -1
- package/docs/testing.md +11 -0
- package/docs/testing.zh-CN.md +10 -0
- package/index.mjs +184 -0
- package/package.json +4 -2
- package/skills/scnet-hpc/SKILL.md +63 -105
- package/skills/scnet-hpc/VERSION +1 -0
- package/skills/scnet-hpc/clusters/_template.conf +10 -4
- package/skills/scnet-hpc/references/adding-cluster.md +6 -1
- package/skills/scnet-hpc/references/backends.md +177 -0
- package/skills/scnet-hpc/references/notebook.md +60 -0
- package/skills/scnet-hpc/references/openapi.md +140 -0
- package/skills/scnet-hpc/references/quickstart-en.md +22 -0
- package/skills/scnet-hpc/references/setup.md +4 -0
- package/skills/scnet-hpc/scripts/__pycache__/compute-probe.cpython-312.pyc +0 -0
- package/skills/scnet-hpc/scripts/__pycache__/scnet.cpython-312.pyc +0 -0
- package/skills/scnet-hpc/scripts/__pycache__/scnet_config.cpython-312.pyc +0 -0
- package/skills/scnet-hpc/scripts/__pycache__/scnet_credentials.cpython-312.pyc +0 -0
- package/skills/scnet-hpc/scripts/__pycache__/scnet_version.cpython-312.pyc +0 -0
- package/skills/scnet-hpc/scripts/scnet.py +1573 -0
- package/skills/scnet-hpc/scripts/scnet_backends/__init__.py +53 -0
- package/skills/scnet-hpc/scripts/scnet_backends/base.py +64 -0
- package/skills/scnet-hpc/scripts/scnet_backends/external.py +92 -0
- package/skills/scnet-hpc/scripts/scnet_backends/openapi.py +771 -0
- package/skills/scnet-hpc/scripts/scnet_backends/profile.py +78 -0
- package/skills/scnet-hpc/scripts/scnet_backends/ssh.py +258 -0
- package/skills/scnet-hpc/scripts/scnet_config.py +175 -0
- package/skills/scnet-hpc/scripts/scnet_credentials.py +160 -0
- package/skills/scnet-hpc/scripts/scnet_sdk/__init__.py +11 -0
- package/skills/scnet-hpc/scripts/scnet_sdk/cli.py +394 -0
- package/skills/scnet-hpc/scripts/scnet_sdk/client.py +240 -0
- package/skills/scnet-hpc/scripts/scnet_sdk/notebook.py +379 -0
- package/skills/scnet-hpc/scripts/scnet_version.py +20 -0
- package/skills/scnet-hpc/scripts/setup-ssh.sh +33 -1
- package/skills/scnet-hpc/scripts/setup.sh +471 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# DSH-SCNet
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[简体中文](./README_CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
DSH-SCNet (`dsh-scnet` on npm) is a community-maintained DSH bundle for operating Supercomputing Network (SCNet). It packages the source [`scnet-hpc`](https://github.com/lql341/scnet-hpc) Skill, profile-aware utilities, and bounded tools for SSH, Slurm, OpenAPI files, regional resources, and Notebook discovery.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Current release: **0.5.0**
|
|
8
8
|
|
|
9
9
|
> This is an independent community project. It is compatible with DeepSeek Harness but is not an official DeepSeek product and does not imply endorsement, partnership, or authorization by DeepSeek.
|
|
10
10
|
|
|
@@ -42,6 +42,14 @@ See [Installation](./docs/installation.md) for npm, GitHub, and local-checkout w
|
|
|
42
42
|
| `scnet_probe_cluster` | Produce an initial profile from read-only login-node probes |
|
|
43
43
|
| `scnet_refresh_cluster` | Refresh time-sensitive profile fields; compute probing is opt-in |
|
|
44
44
|
| `scnet_run_compute_probe` | Submit a minimal compute-node capability probe |
|
|
45
|
+
| `scnet_status` | Read the saved backend, SSH profile, and OpenAPI configuration |
|
|
46
|
+
| `scnet_openapi_regions` | List authorized OpenAPI regions without exposing tokens |
|
|
47
|
+
| `scnet_job_queues` | Query regional Slurm queues and live resource availability |
|
|
48
|
+
| `scnet_file_list` | List shared-storage files through the common file API |
|
|
49
|
+
| `scnet_notebook_regions` | List Notebook-capable regions |
|
|
50
|
+
| `scnet_notebook_resources` | Query Notebook CPU/GPU/DCU resources |
|
|
51
|
+
| `scnet_notebook_list` | List Notebook instances with sensitive fields redacted |
|
|
52
|
+
| `scnet_notebook_show` | Inspect one redacted Notebook instance |
|
|
45
53
|
|
|
46
54
|
Packaged profiles currently cover Zhengzhou, Kunshan, Wuzhen, and Xi'an SCNet environments. Cluster specifications and scheduler policies remain profile-specific and should be verified against the target environment.
|
|
47
55
|
|
|
@@ -57,6 +65,8 @@ Packaged profiles currently cover Zhengzhou, Kunshan, Wuzhen, and Xi'an SCNet en
|
|
|
57
65
|
│ ├── clusters/
|
|
58
66
|
│ ├── references/
|
|
59
67
|
│ └── scripts/
|
|
68
|
+
│ ├── scnet_backends/
|
|
69
|
+
│ └── scnet_sdk/
|
|
60
70
|
├── scripts/validate-package.mjs
|
|
61
71
|
├── docs/
|
|
62
72
|
├── sync.sh
|
|
@@ -89,6 +99,8 @@ See [Testing](./docs/testing.md) for local package installation and risk-ordered
|
|
|
89
99
|
|
|
90
100
|
- The repository and npm package must not contain private keys, tokens, usernames, private endpoints, or local probe caches.
|
|
91
101
|
- SSH configuration, remote probes, and Slurm submission are state-changing operations and require an explicit target and user authorization.
|
|
102
|
+
- OpenAPI and Notebook DSH tools are read-only; lifecycle mutations remain behind the Skill CLI confirmation flow.
|
|
103
|
+
- Notebook passwords and credential-bearing URL queries are redacted by default.
|
|
92
104
|
- Generated Slurm files may include local usernames and are ignored by Git.
|
|
93
105
|
- Accelerator compatibility claims require evidence from the target compute node.
|
|
94
106
|
|
|
@@ -98,118 +110,13 @@ The project uses the abbreviated `DSH` ecosystem identifier in its name. Referen
|
|
|
98
110
|
|
|
99
111
|
The naming and attribution policy follows the [DeepSeek Harness brand guidelines](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.1.0-rc.8/BRAND_GUIDELINES.md).
|
|
100
112
|
|
|
101
|
-
##
|
|
102
|
-
|
|
103
|
-
This project is released under the [MIT License](LICENSE). Subject to the license terms, the software may be used, copied, modified, merged, published, sublicensed, and distributed, including for commercial purposes.
|
|
104
|
-
|
|
105
|
-
Redistributions must retain the copyright notice and the MIT license notice. The software is provided “as is,” without warranties of any kind; users are responsible for evaluating the suitability and risks of the bundle, skill instructions, cluster profiles, scripts, and generated outputs for their own environment.
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## 简体中文
|
|
110
|
-
|
|
111
|
-
[English](#english) | [简体中文](#简体中文)
|
|
112
|
-
|
|
113
|
-
<p align="center">在 DeepSeek Harness 里操作超算互联网(SCNet)集群:配 SSH、生成 CPU/DCU Slurm 作业、探测/刷新集群、运行计算节点探针、排查失败,附海光 DCU/DTK 知识和英文快速指南。</p>
|
|
114
|
-
|
|
115
|
-
> 本项目是独立维护的社区项目,与 DeepSeek Harness 兼容,但不是 DeepSeek 官方产品,也不表示 DeepSeek 对本项目提供背书、合作或授权。
|
|
116
|
-
|
|
117
|
-
## 这是什么
|
|
118
|
-
|
|
119
|
-
一个 DeepSeek Harness bundle 插件,把 `scnet-hpc` 的 Agent Skill 和 bash 脚本包装成 DSH 可安装包。装好后 DSH 模型在涉及超算集群、Slurm 作业、海光 DCU/DTK 时会加载对应 skill,并可调用工具完成确定性操作。
|
|
120
|
-
|
|
121
|
-
## 安装
|
|
122
|
-
|
|
123
|
-
推荐从 npm 安装:
|
|
124
|
-
|
|
125
|
-
```sh
|
|
126
|
-
dsh plugin --profile web add dsh-scnet
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
git 源、本地目录安装以及验证步骤见[安装说明](./docs/installation.zh-CN.md)。
|
|
130
|
-
|
|
131
|
-
## 能力面
|
|
132
|
-
|
|
133
|
-
### Skills
|
|
134
|
-
|
|
135
|
-
| Skill | 作用 |
|
|
136
|
-
|---|---|
|
|
137
|
-
| scnet-hpc | 国产超算使用规范:连接、提交/监控、调试、失败排查、海光 DCU/DTK 资源索引 |
|
|
138
|
-
|
|
139
|
-
### 内置集群
|
|
113
|
+
## Versioning
|
|
140
114
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
| zzeshell | 超算互联网 · 郑州 | 海光 BW1000 DCU (gfx936) ×8, 64GB/卡 |
|
|
144
|
-
| kseshell | 超算互联网 · 昆山 | 海光 Z100 DCU (gfx906) ×4, 16GB/卡 |
|
|
145
|
-
| wuzhshell | 超算互联网 · 乌镇 | 海光 Z100 DCU (gfx906) ×4, 16GB/卡 |
|
|
146
|
-
| xianshell | 超算互联网 · 西安 | 海光 Z100 DCU (gfx906) ×4, 16GB/卡 |
|
|
147
|
-
|
|
148
|
-
### Tools
|
|
149
|
-
|
|
150
|
-
| 工具 | 说明 |
|
|
151
|
-
|---|---|
|
|
152
|
-
| scnet_list_clusters | 列出已配置的集群 profile |
|
|
153
|
-
| scnet_show_cluster | 读取指定集群的完整参数 |
|
|
154
|
-
| scnet_generate_job | 按 profile 生成加速器或 CPU-only Slurm 作业,支持显式分区覆盖 |
|
|
155
|
-
| scnet_setup_ssh | 配置本地到集群的 SSH 连接 |
|
|
156
|
-
| scnet_probe_cluster | 探测新集群并生成 profile |
|
|
157
|
-
| scnet_refresh_cluster | 动态刷新已有集群的规则缓存 |
|
|
158
|
-
| scnet_run_compute_probe | 在计算节点运行最小能力探针 |
|
|
159
|
-
|
|
160
|
-
## 文档
|
|
161
|
-
|
|
162
|
-
- [安装说明](./docs/installation.zh-CN.md)
|
|
163
|
-
- [测试说明](./docs/testing.zh-CN.md)
|
|
164
|
-
|
|
165
|
-
## 结构
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
.
|
|
169
|
-
├── package.json # dsh.bundle manifest
|
|
170
|
-
├── cordis.patch.yml # bundle 组合层
|
|
171
|
-
├── index.mjs # Cordis 入口,注册 7 个工具
|
|
172
|
-
├── skills/scnet-hpc/
|
|
173
|
-
│ ├── clusters/
|
|
174
|
-
│ │ ├── zzeshell.conf
|
|
175
|
-
│ │ ├── kseshell.conf
|
|
176
|
-
│ │ ├── wuzhshell.conf
|
|
177
|
-
│ │ └── xianshell.conf
|
|
178
|
-
│ ├── scripts/
|
|
179
|
-
│ └── references/
|
|
180
|
-
├── sync.sh # 从 canonical 仓库同步
|
|
181
|
-
├── README.md # 英文默认说明
|
|
182
|
-
├── README_CN.md # 中文说明
|
|
183
|
-
├── docs/ # 中英文安装与测试文档
|
|
184
|
-
├── LICENSE
|
|
185
|
-
└── .gitignore
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## 同步
|
|
189
|
-
|
|
190
|
-
本仓库是发布面,知识内容(`skills/scnet-hpc/` 下的 SKILL.md、clusters、references、scripts)从 canonical 仓库 `lql341/scnet-hpc` 同步:
|
|
191
|
-
|
|
192
|
-
```sh
|
|
193
|
-
./sync.sh # 当前本机布局默认 ../../skills/scnet-hpc
|
|
194
|
-
./sync.sh --src /path/to/scnet-hpc
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
只改 canonical,本仓库跑 sync 更新;不要把 `skills/scnet-hpc/` 当手工维护目录。
|
|
198
|
-
`sync.sh` 会自动排除 `scripts/install.sh` 和 `clusters/.cache/`,避免把安装脚本或本机动态缓存打进发布包。
|
|
199
|
-
|
|
200
|
-
## 隐私与安全
|
|
201
|
-
|
|
202
|
-
- 仓库不含私钥、token、用户名、密钥指纹。
|
|
203
|
-
- `scnet_setup_ssh` 会写入 `~/.ssh/`,调用前确认私钥路径和集群。
|
|
204
|
-
- `scnet_generate_job` 生成的 `.slurm` 可能含本机用户名,`.gitignore` 已排除。
|
|
205
|
-
- SSH 接入端点仅使用平台面向用户公开提供的信息,由 canonical 仓库维护。
|
|
206
|
-
- `scnet_refresh_cluster` / `scnet_run_compute_probe` 会 SSH 到远端并可能提交作业;运行前确认集群和副作用。
|
|
207
|
-
- `clusters/.cache/` 是本机动态探测缓存,`.gitignore` 已排除,不应提交。
|
|
115
|
+
The npm package version matches `skills/scnet-hpc/VERSION` and follows the same SemVer release
|
|
116
|
+
train as the source Skill.
|
|
208
117
|
|
|
209
118
|
## License
|
|
210
119
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
再发布本项目或其重要组成部分时,应保留版权声明和 MIT 许可声明。本项目按“现状”提供,不对适销性、特定用途适用性或不侵权作任何明示或默示保证;使用者应自行评估 DSH bundle、skill 说明、集群配置、脚本和生成结果在其环境中的适用性与风险。
|
|
120
|
+
This project is released under the [MIT License](LICENSE). Subject to the license terms, the software may be used, copied, modified, merged, published, sublicensed, and distributed, including for commercial purposes.
|
|
214
121
|
|
|
215
|
-
|
|
122
|
+
Redistributions must retain the copyright notice and the MIT license notice. The software is provided “as is,” without warranties of any kind; users are responsible for evaluating the suitability and risks of the bundle, skill instructions, cluster profiles, scripts, and generated outputs for their own environment.
|
package/README_CN.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
<p align="center">在 DeepSeek Harness 里操作超算互联网(SCNet
|
|
5
|
+
<p align="center">在 DeepSeek Harness 里操作超算互联网(SCNet):配置 SSH、管理 Slurm 作业、查询 OpenAPI 区域和文件、检查 Notebook 资源与实例,并保留海光 DCU/DTK 诊断能力。</p>
|
|
6
|
+
|
|
7
|
+
当前版本:**0.5.0**
|
|
6
8
|
|
|
7
9
|
> 本项目是独立维护的社区项目,与 DeepSeek Harness 兼容,但不是 DeepSeek 官方产品,也不表示 DeepSeek 对本项目提供背书、合作或授权。
|
|
8
10
|
|
|
@@ -48,6 +50,14 @@ git 源、本地目录安装以及验证步骤见[安装说明](./docs/installat
|
|
|
48
50
|
| scnet_probe_cluster | 探测新集群并生成 profile |
|
|
49
51
|
| scnet_refresh_cluster | 动态刷新已有集群的规则缓存 |
|
|
50
52
|
| scnet_run_compute_probe | 在计算节点运行最小能力探针 |
|
|
53
|
+
| scnet_status | 只读查看 backend、SSH profile 和 OpenAPI 配置 |
|
|
54
|
+
| scnet_openapi_regions | 列出授权 OpenAPI 区域,不暴露 token |
|
|
55
|
+
| scnet_job_queues | 查询区域 Slurm 队列和实时空闲资源 |
|
|
56
|
+
| scnet_file_list | 通过通用文件 API 列出共享存储 |
|
|
57
|
+
| scnet_notebook_regions | 列出支持 Notebook 的区域 |
|
|
58
|
+
| scnet_notebook_resources | 查询 Notebook CPU/GPU/DCU 资源 |
|
|
59
|
+
| scnet_notebook_list | 列出 Notebook 实例并脱敏敏感字段 |
|
|
60
|
+
| scnet_notebook_show | 查询一个脱敏后的 Notebook 实例详情 |
|
|
51
61
|
|
|
52
62
|
## 文档
|
|
53
63
|
|
|
@@ -68,6 +78,8 @@ git 源、本地目录安装以及验证步骤见[安装说明](./docs/installat
|
|
|
68
78
|
│ │ ├── wuzhshell.conf
|
|
69
79
|
│ │ └── xianshell.conf
|
|
70
80
|
│ ├── scripts/
|
|
81
|
+
│ │ ├── scnet_backends/
|
|
82
|
+
│ │ └── scnet_sdk/
|
|
71
83
|
│ └── references/
|
|
72
84
|
├── sync.sh # 从 canonical 仓库同步
|
|
73
85
|
├── README.md # 英文默认说明
|
|
@@ -96,6 +108,8 @@ git 源、本地目录安装以及验证步骤见[安装说明](./docs/installat
|
|
|
96
108
|
- `scnet_generate_job` 生成的 `.slurm` 可能含本机用户名,`.gitignore` 已排除。
|
|
97
109
|
- SSH 接入端点仅使用平台面向用户公开提供的信息,由 canonical 仓库维护。
|
|
98
110
|
- `scnet_refresh_cluster` / `scnet_run_compute_probe` 会 SSH 到远端并可能提交作业;运行前确认集群和副作用。
|
|
111
|
+
- 新增 OpenAPI 和 Notebook DSH 工具均为只读;Notebook 生命周期变更仍通过 Skill CLI 的确认流程执行。
|
|
112
|
+
- Notebook 密码和带凭据的 URL 查询参数默认脱敏。
|
|
99
113
|
- `clusters/.cache/` 是本机动态探测缓存,`.gitignore` 已排除,不应提交。
|
|
100
114
|
|
|
101
115
|
## License
|
|
@@ -105,3 +119,8 @@ git 源、本地目录安装以及验证步骤见[安装说明](./docs/installat
|
|
|
105
119
|
再发布本项目或其重要组成部分时,应保留版权声明和 MIT 许可声明。本项目按“现状”提供,不对适销性、特定用途适用性或不侵权作任何明示或默示保证;使用者应自行评估 DSH bundle、skill 说明、集群配置、脚本和生成结果在其环境中的适用性与风险。
|
|
106
120
|
|
|
107
121
|
项目命名与归属声明遵循 [DeepSeek Harness 品牌素材使用规范](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.1.0-rc.8/BRAND_GUIDELINES.zh.md)。
|
|
122
|
+
|
|
123
|
+
## 版本管理
|
|
124
|
+
|
|
125
|
+
npm package 版本与 `skills/scnet-hpc/VERSION` 保持一致,并与源 Skill 使用同一套 SemVer
|
|
126
|
+
发布版本。
|
package/docs/installation.md
CHANGED
|
@@ -58,3 +58,13 @@ dsh web
|
|
|
58
58
|
## Credentials
|
|
59
59
|
|
|
60
60
|
Model credentials belong in the DSH credential store or its supported settings interface. SCNet private keys remain local and are supplied only when the user explicitly invokes SSH setup. Neither credential type belongs in this repository.
|
|
61
|
+
|
|
62
|
+
SCNet OpenAPI uses a platform username, AccessKey, and SecretKey. Configure them through the
|
|
63
|
+
bundled Skill:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
python3 skills/scnet-hpc/scripts/scnet.py setup modify --mode openapi
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
On macOS credentials can be stored in Keychain. On Linux, install `libsecret-tools` for Secret
|
|
70
|
+
Service; otherwise inject the documented `SCNET_OPENAPI_*` environment variables.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# 安装 DSH-SCNet
|
|
2
2
|
|
|
3
|
-
DSH-SCNet(npm 包名:`dsh-scnet
|
|
3
|
+
DSH-SCNet(npm 包名:`dsh-scnet`)是一个 DeepSeek Harness(DSH)bundle 插件,把
|
|
4
|
+
SCNet 使用规范、SSH/Slurm 工具、OpenAPI 只读资源工具和 Notebook 资源工具打包到一起。
|
|
4
5
|
|
|
5
6
|
## 前置条件
|
|
6
7
|
|
|
@@ -71,3 +72,14 @@ DEEPSEEK_API_KEY: sk-你的key
|
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
保存后无需重启,下一次请求即生效。Key 只保存在本机 `~/.dsh` 下,不会写入仓库。
|
|
75
|
+
|
|
76
|
+
## 配置 SCNet OpenAPI
|
|
77
|
+
|
|
78
|
+
SCNet OpenAPI 使用平台用户名、AccessKey 和 SecretKey:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
python3 skills/scnet-hpc/scripts/scnet.py setup modify --mode openapi
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
macOS 可保存到 Keychain。Linux 安装 `libsecret-tools` 后使用 Secret Service;否则通过
|
|
85
|
+
文档定义的 `SCNET_OPENAPI_*` 环境变量注入。OpenAPI 凭据不会写入插件仓库。
|
package/docs/testing.md
CHANGED
|
@@ -37,6 +37,14 @@ Confirm that the composed configuration includes:
|
|
|
37
37
|
| `scnet_list_clusters` | Returns the packaged cluster identifiers |
|
|
38
38
|
| `scnet_show_cluster` | Returns the selected profile contents |
|
|
39
39
|
| `scnet_generate_job` | Writes a profile-aware Slurm script in the current directory |
|
|
40
|
+
| `scnet_status` | Returns redacted local SCNet configuration |
|
|
41
|
+
| `scnet_openapi_regions` | Returns authorized regions without tokens |
|
|
42
|
+
| `scnet_job_queues` | Returns live regional Slurm queues |
|
|
43
|
+
| `scnet_file_list` | Lists shared-storage files without modification |
|
|
44
|
+
| `scnet_notebook_regions` | Lists Notebook-capable regions |
|
|
45
|
+
| `scnet_notebook_resources` | Returns Notebook resource groups |
|
|
46
|
+
| `scnet_notebook_list` | Lists redacted Notebook instances |
|
|
47
|
+
| `scnet_notebook_show` | Returns one redacted Notebook instance |
|
|
40
48
|
|
|
41
49
|
Check both accelerator and CPU-only job generation. Review the output for the selected partition, memory, and GRES rules.
|
|
42
50
|
|
|
@@ -52,6 +60,9 @@ Check both accelerator and CPU-only job generation. Review the output for the se
|
|
|
52
60
|
|
|
53
61
|
`scnet_run_compute_probe` and refresh operations with compute probing submit Slurm jobs. Confirm the target cluster, account policy, accelerator count, CPU count, and time limit before execution.
|
|
54
62
|
|
|
63
|
+
Notebook lifecycle mutations are intentionally not exposed as deterministic DSH tools in this
|
|
64
|
+
release. Test them only through the Skill CLI and start with `--dry-run`.
|
|
65
|
+
|
|
55
66
|
## Cleanup
|
|
56
67
|
|
|
57
68
|
Remove the isolated test profile after verification:
|
package/docs/testing.zh-CN.md
CHANGED
|
@@ -58,5 +58,15 @@ DEEPSEEK_API_KEY: sk-你的key
|
|
|
58
58
|
| 5 | 用 scnet_probe_cluster 探测集群 | 需要真实集群,会 SSH 到远端 | 中 |
|
|
59
59
|
| 6 | 用 scnet_refresh_cluster dry_run=true 刷新规则 | 输出即将写入的缓存,不落盘 | 中(会 SSH) |
|
|
60
60
|
| 7 | 用 scnet_run_compute_probe 跑计算节点探针 | 返回 PROBE_ 结果 | 高(提交作业并等待) |
|
|
61
|
+
| 8 | 用 scnet_status 查看当前配置 | 返回脱敏配置 | 只读 |
|
|
62
|
+
| 9 | 用 scnet_openapi_regions 查看授权区域 | 返回区域且不含 token | 只读 |
|
|
63
|
+
| 10 | 用 scnet_job_queues 查看昆山队列 | 返回实时队列和空闲资源 | 只读 |
|
|
64
|
+
| 11 | 用 scnet_file_list 查看默认目录 | 返回共享存储文件 | 只读 |
|
|
65
|
+
| 12 | 用 scnet_notebook_regions 查看区域 | 返回 Notebook 可用区域 | 只读 |
|
|
66
|
+
| 13 | 用 scnet_notebook_resources 查看昆山资源 | 返回 CPU/GPU/DCU 资源 | 只读 |
|
|
67
|
+
| 14 | 用 scnet_notebook_list 查看实例 | 返回脱敏实例列表 | 只读 |
|
|
61
68
|
|
|
62
69
|
第 4 至 7 步只有在你有私钥和目标集群时才测,测前确认副作用。
|
|
70
|
+
|
|
71
|
+
Notebook 创建、启动、停止和释放没有作为 DSH deterministic tool 暴露。此类操作通过
|
|
72
|
+
Skill CLI 执行,并先使用 `--dry-run`。
|
package/index.mjs
CHANGED
|
@@ -31,6 +31,35 @@ function runBash(script, args, timeoutMs = 120000, cwd = SKILL_DIR) {
|
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function runScnet(args, timeoutMs = 120000) {
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
execFile(
|
|
37
|
+
'python3',
|
|
38
|
+
[join(SCRIPTS_DIR, 'scnet.py'), '--json', ...args],
|
|
39
|
+
{ cwd: SKILL_DIR, timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 },
|
|
40
|
+
(error, stdout, stderr) => {
|
|
41
|
+
const code = error ? (typeof error.code === 'number' ? error.code : 1) : 0
|
|
42
|
+
resolve({
|
|
43
|
+
ok: code === 0,
|
|
44
|
+
code,
|
|
45
|
+
stdout: String(stdout || ''),
|
|
46
|
+
stderr: String(stderr || ''),
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function scnetResult(res, action) {
|
|
54
|
+
if (res.ok) return res.stdout.trim() || '{}'
|
|
55
|
+
return `${action}失败(exit ${res.code}):\n${res.stderr.trim() || res.stdout.trim()}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function regionArgs(region) {
|
|
59
|
+
const value = String(region || '').trim()
|
|
60
|
+
return value ? ['--region', value] : []
|
|
61
|
+
}
|
|
62
|
+
|
|
34
63
|
function textBlock(value) {
|
|
35
64
|
return [{ type: 'text', text: value }]
|
|
36
65
|
}
|
|
@@ -91,6 +120,161 @@ export function apply(ctx) {
|
|
|
91
120
|
}),
|
|
92
121
|
)
|
|
93
122
|
|
|
123
|
+
ctx.tools.register(
|
|
124
|
+
defineTool({
|
|
125
|
+
name: 'scnet_status',
|
|
126
|
+
description: '只读查看 scnet-hpc 当前默认 backend、SSH profile 和 OpenAPI 区域配置;不会连接远端或修改配置。',
|
|
127
|
+
parameters: {},
|
|
128
|
+
output: {
|
|
129
|
+
schema: { type: 'string' },
|
|
130
|
+
render: (_args, value) => textBlock(value),
|
|
131
|
+
},
|
|
132
|
+
async execute() {
|
|
133
|
+
return scnetResult(await runScnet(['config']), '读取 SCNet 配置')
|
|
134
|
+
},
|
|
135
|
+
}),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
ctx.tools.register(
|
|
139
|
+
defineTool({
|
|
140
|
+
name: 'scnet_openapi_regions',
|
|
141
|
+
description: '通过已配置的 SCNet OpenAPI 凭据只读列出授权计算区域,不显示 token。',
|
|
142
|
+
parameters: {},
|
|
143
|
+
output: {
|
|
144
|
+
schema: { type: 'string' },
|
|
145
|
+
render: (_args, value) => textBlock(value),
|
|
146
|
+
},
|
|
147
|
+
async execute() {
|
|
148
|
+
return scnetResult(
|
|
149
|
+
await runScnet(['--backend', 'openapi', 'clusters']),
|
|
150
|
+
'查询 OpenAPI 区域',
|
|
151
|
+
)
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
ctx.tools.register(
|
|
157
|
+
defineTool({
|
|
158
|
+
name: 'scnet_job_queues',
|
|
159
|
+
description: '通过 OpenAPI 只读查询目标区域可访问的 Slurm 队列、空闲资源和单作业限制。',
|
|
160
|
+
parameters: {
|
|
161
|
+
region: { type: 'string', description: '区域名称或 ID;省略时使用已保存的默认区域' },
|
|
162
|
+
},
|
|
163
|
+
output: {
|
|
164
|
+
schema: { type: 'string' },
|
|
165
|
+
render: (_args, value) => textBlock(value),
|
|
166
|
+
},
|
|
167
|
+
async execute(args) {
|
|
168
|
+
return scnetResult(
|
|
169
|
+
await runScnet(['--backend', 'openapi', ...regionArgs(args.region), 'queues']),
|
|
170
|
+
'查询作业队列',
|
|
171
|
+
)
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
ctx.tools.register(
|
|
177
|
+
defineTool({
|
|
178
|
+
name: 'scnet_file_list',
|
|
179
|
+
description: '通过 OpenAPI 只读列出区域共享存储中的文件和目录。',
|
|
180
|
+
parameters: {
|
|
181
|
+
region: { type: 'string', description: '区域名称或 ID;省略时使用默认区域' },
|
|
182
|
+
path: { type: 'string', description: '绝对目录路径;省略时使用区域用户主目录' },
|
|
183
|
+
limit: { type: 'number', description: '最多返回条数,默认 100' },
|
|
184
|
+
},
|
|
185
|
+
output: {
|
|
186
|
+
schema: { type: 'string' },
|
|
187
|
+
render: (_args, value) => textBlock(value),
|
|
188
|
+
},
|
|
189
|
+
async execute(args) {
|
|
190
|
+
const argv = ['--backend', 'openapi', ...regionArgs(args.region), 'files']
|
|
191
|
+
if (args.path) argv.push('--path', String(args.path))
|
|
192
|
+
if (args.limit) argv.push('--limit', String(args.limit))
|
|
193
|
+
return scnetResult(await runScnet(argv), '查询文件')
|
|
194
|
+
},
|
|
195
|
+
}),
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
ctx.tools.register(
|
|
199
|
+
defineTool({
|
|
200
|
+
name: 'scnet_notebook_regions',
|
|
201
|
+
description: '只读列出支持 SCNet Notebook 服务的授权区域。',
|
|
202
|
+
parameters: {},
|
|
203
|
+
output: {
|
|
204
|
+
schema: { type: 'string' },
|
|
205
|
+
render: (_args, value) => textBlock(value),
|
|
206
|
+
},
|
|
207
|
+
async execute() {
|
|
208
|
+
return scnetResult(
|
|
209
|
+
await runScnet(['--backend', 'openapi', 'notebook', 'regions']),
|
|
210
|
+
'查询 Notebook 区域',
|
|
211
|
+
)
|
|
212
|
+
},
|
|
213
|
+
}),
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
ctx.tools.register(
|
|
217
|
+
defineTool({
|
|
218
|
+
name: 'scnet_notebook_resources',
|
|
219
|
+
description: '只读查询目标区域可用于 Notebook 的 CPU/GPU/DCU 资源及当前空闲卡数。',
|
|
220
|
+
parameters: {
|
|
221
|
+
region: { type: 'string', description: '区域名称或 ID;省略时使用默认区域' },
|
|
222
|
+
},
|
|
223
|
+
output: {
|
|
224
|
+
schema: { type: 'string' },
|
|
225
|
+
render: (_args, value) => textBlock(value),
|
|
226
|
+
},
|
|
227
|
+
async execute(args) {
|
|
228
|
+
const argv = ['--backend', 'openapi', 'notebook', 'resources']
|
|
229
|
+
if (args.region) argv.push('--region', String(args.region))
|
|
230
|
+
return scnetResult(await runScnet(argv), '查询 Notebook 资源')
|
|
231
|
+
},
|
|
232
|
+
}),
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
ctx.tools.register(
|
|
236
|
+
defineTool({
|
|
237
|
+
name: 'scnet_notebook_list',
|
|
238
|
+
description: '只读列出目标区域的 Notebook 实例;密码和带凭据的 URL 默认脱敏。',
|
|
239
|
+
parameters: {
|
|
240
|
+
region: { type: 'string', description: '区域名称或 ID;省略时使用默认区域' },
|
|
241
|
+
status: { type: 'string', description: '可选状态过滤,如 Running、Terminated、Failed' },
|
|
242
|
+
},
|
|
243
|
+
output: {
|
|
244
|
+
schema: { type: 'string' },
|
|
245
|
+
render: (_args, value) => textBlock(value),
|
|
246
|
+
},
|
|
247
|
+
async execute(args) {
|
|
248
|
+
const argv = ['--backend', 'openapi', 'notebook', 'list']
|
|
249
|
+
if (args.region) argv.push('--region', String(args.region))
|
|
250
|
+
if (args.status) argv.push('--status', String(args.status))
|
|
251
|
+
return scnetResult(await runScnet(argv), '查询 Notebook 实例')
|
|
252
|
+
},
|
|
253
|
+
}),
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
ctx.tools.register(
|
|
257
|
+
defineTool({
|
|
258
|
+
name: 'scnet_notebook_show',
|
|
259
|
+
description: '只读查询一个 Notebook 实例详情;敏感字段默认脱敏。',
|
|
260
|
+
parameters: {
|
|
261
|
+
notebook_id: { type: 'string', required: true, description: 'Notebook 实例 ID' },
|
|
262
|
+
region: { type: 'string', description: '区域名称或 ID;省略时使用默认区域' },
|
|
263
|
+
},
|
|
264
|
+
output: {
|
|
265
|
+
schema: { type: 'string' },
|
|
266
|
+
render: (_args, value) => textBlock(value),
|
|
267
|
+
},
|
|
268
|
+
async execute(args) {
|
|
269
|
+
const id = String(args.notebook_id || '').trim()
|
|
270
|
+
if (!id) return '缺少必填参数 notebook_id。'
|
|
271
|
+
const argv = ['--backend', 'openapi', 'notebook', 'show', id]
|
|
272
|
+
if (args.region) argv.push('--region', String(args.region))
|
|
273
|
+
return scnetResult(await runScnet(argv), '查询 Notebook 详情')
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
)
|
|
277
|
+
|
|
94
278
|
ctx.tools.register(
|
|
95
279
|
defineTool({
|
|
96
280
|
name: 'scnet_show_cluster',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-scnet",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Community DeepSeek Harness bundle for SCNet
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Community DeepSeek Harness bundle for SCNet SSH and OpenAPI jobs, files, Notebook resources, Slurm diagnostics, and Hygon DCU/DTK guidance.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"dsh-plugin",
|
|
44
44
|
"dsh-bundle",
|
|
45
45
|
"slurm",
|
|
46
|
+
"openapi",
|
|
47
|
+
"notebook",
|
|
46
48
|
"hpc",
|
|
47
49
|
"hygon",
|
|
48
50
|
"dcu",
|