docs: 统一 suite-developer/TOOLS.md — script_id + $params.xxx + gis-base:latest
This commit is contained in:
+18
-71
@@ -2,81 +2,40 @@
|
||||
|
||||
## 安装
|
||||
|
||||
### gis-actions v3.0.2(CLI + 执行引擎,一个 deb 全包)
|
||||
### gis-actions(CLI + 执行引擎)
|
||||
|
||||
```bash
|
||||
curl -sLO https://git.mercator.cn/api/packages/SuiteHub/generic/gis-actions/3.0.2/gis-actions_3.0.2_all.deb
|
||||
sudo dpkg -i gis-actions_3.0.2_all.deb
|
||||
curl -sLO https://git.mercator.cn/api/packages/SuiteHub/generic/gis-actions/3.0.1/gis-actions_3.0.1_all.deb
|
||||
sudo dpkg -i gis-actions_3.0.1_all.deb
|
||||
```
|
||||
|
||||
安装后直接使用 `agc` 命令。首次安装时 postinst 会自动下载 gis-base 镜像。
|
||||
|
||||
### 前提条件
|
||||
|
||||
- **Linux 系统**(Debian / Ubuntu)
|
||||
- **Docker**(`sudo apt-get install -y docker.io`)
|
||||
|
||||
### gis-base 基础镜像
|
||||
|
||||
所有套件在 gis-base 镜像中执行(Python 3, GDAL, Shapely, GeoPandas, numpy, openpyxl, xlrd)。
|
||||
|
||||
镜像从 Gitea Packages 加载(无需 registry 账号):
|
||||
### agentgis-sdk(Python 开发包)
|
||||
|
||||
```bash
|
||||
curl -sLO https://git.mercator.cn/api/packages/SuiteHub/generic/gis-base/1.0.0/gis-base.tar.gz
|
||||
docker load -i gis-base.tar.gz
|
||||
pip install https://git.mercator.cn/api/packages/SuiteHub/generic/agentgis-sdk/0.1.0/agentgis_sdk-0.1.0-py3-none-any.whl
|
||||
```
|
||||
|
||||
> 安装 gis-actions deb 时已自动执行上述步骤,通常无需手动操作。
|
||||
|
||||
---
|
||||
|
||||
## CLI 用法
|
||||
|
||||
`agc` 目前只有一个命令:`run`。
|
||||
|
||||
```bash
|
||||
# 执行套件(唯一命令)
|
||||
agc run /tmp/output --suite-id <suite-id> --input key=value
|
||||
# 执行套件
|
||||
agc run <work_dir> --suite-id <suite-id> --input key=value
|
||||
agc run <work_dir> --package-url <url> --input key=value
|
||||
|
||||
# 示例
|
||||
agc run /tmp/output --suite-id 2c99a1cb-84a5-42dd-9147-1c8e8f7f2941 --input buffer_distance=0.5
|
||||
```
|
||||
|
||||
### 查询市场(通过 curl,agc 暂未内置)
|
||||
|
||||
```bash
|
||||
# 列出所有套件
|
||||
# 查市场(开发前先做这个)
|
||||
curl -s https://suites.mercator.cn/api/v1/suites | python3 -m json.tool
|
||||
|
||||
# 搜索套件
|
||||
curl -s "https://suites.mercator.cn/api/v1/suites/search?q=缓冲区"
|
||||
|
||||
# 查看套件详情
|
||||
curl -s https://suites.mercator.cn/api/v1/suites/<suite-id>
|
||||
```
|
||||
|
||||
### 发布套件(通过 API)
|
||||
|
||||
```bash
|
||||
# 打包
|
||||
tar czf suite.tgz --exclude='.git' --exclude='__pycache__' my-suite/
|
||||
|
||||
# 上传发布
|
||||
curl -X POST https://suites.mercator.cn/api/v1/publish/upload \
|
||||
-H "Authorization: Bearer $KEY" \
|
||||
-F "file=@suite.tgz"
|
||||
```
|
||||
|
||||
## API 端点
|
||||
|
||||
| 用途 | 端点 |
|
||||
|------|------|
|
||||
| 发布 Suite(上传) | `POST https://suites.mercator.cn/api/v1/publish/upload` |
|
||||
| 发布 Suite(Git) | `POST https://suites.mercator.cn/api/v1/publish` |
|
||||
| 列出套件 | `GET https://suites.mercator.cn/api/v1/suites` |
|
||||
| 套件详情 | `GET https://suites.mercator.cn/api/v1/suites/{suite_id}` |
|
||||
| 浏览套件 | `GET https://suites.mercator.cn/api/v1/suites` |
|
||||
| 套件详情 | `GET https://suites.mercator.cn/api/v1/suites/{id}` |
|
||||
| API 文档 | `https://suites.mercator.cn/docs` |
|
||||
| 发布套件 | `POST https://suites.mercator.cn/api/v1/publish`(详见发布指南) |
|
||||
|
||||
## 套件结构
|
||||
|
||||
@@ -87,9 +46,7 @@ my-suite/
|
||||
└── run.py # 执行入口脚本
|
||||
```
|
||||
|
||||
### workflow.yaml 格式规范
|
||||
|
||||
使用 `steps` + `$params.xxx` 格式:
|
||||
### workflow.yaml 格式
|
||||
|
||||
```yaml
|
||||
name: 我的套件
|
||||
@@ -104,32 +61,22 @@ params:
|
||||
required: true
|
||||
desc: 输入文件路径
|
||||
|
||||
nodes:
|
||||
- id: start
|
||||
type: start
|
||||
base_image: gis-base:latest
|
||||
|
||||
steps:
|
||||
- id: step1
|
||||
name: 步骤名称
|
||||
type: python
|
||||
script_id: run
|
||||
depends_on:
|
||||
- start
|
||||
params:
|
||||
input: "${{inputs.input_path}}"
|
||||
|
||||
- id: end
|
||||
type: end
|
||||
depends_on:
|
||||
- step1
|
||||
input: $params.input_path
|
||||
```
|
||||
|
||||
> **工作流格式**:使用 `nodes` 定义 DAG,每个节点通过 `depends_on` 指定前驱节点。必须有 `start` 和 `end` 类型节点作为起止。参数用 `${{inputs.xxx}}` 语法引用。
|
||||
|
||||
## 基础镜像
|
||||
|
||||
所有套件在 gis-base 镜像中执行,包含:Python 3, GDAL, Shapely, GeoPandas, numpy, openpyxl, xlrd
|
||||
|
||||
镜像名称:`gis-base:latest`(本地加载,无需 registry)
|
||||
- 镜像名:`gis-base:latest`
|
||||
- 来源:安装 gis-actions 时自动从 Gitea Packages 下载加载
|
||||
|
||||
## 知识库
|
||||
|
||||
|
||||
Reference in New Issue
Block a user