Files
xc_validation_strategy_vllm…/README.md
2026-07-25 15:30:17 +08:00

52 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# xc_validation_strategy_vllm_stop
用于停止 `zhoukaile` 账号当前状态为 `waiting` 的验证任务的 ModelHub XC 策略服务。
服务启动后会调用:
```text
PUT /api/async/task/stop-create-contest-task
{"taskIds": [任务 ID, ...]}
```
停止请求完成后,进程继续运行,以便平台通过健康检查和状态接口读取执行结果。
## 必填配置
在策略构建/运行环境中配置以下机密环境变量:
```text
XC_TOKEN=<zhoukaile 的 xc-Token>
USER_PASSWORD=<zhoukaile 的登录密码>
```
`USER_PASSWORD` 仅用于获得短期 Bearer Token以分页读取该账号实时提交的验证任务`XC_TOKEN` 用于停止接口。两者均不写入仓库。可选配置如下:
| 变量 | 默认值 | 说明 |
| --- | --- | --- |
| `TASK_IDS` | 无 | 可选的逗号分隔任务 ID设置后跳过实时查询仅停止指定 ID。 |
| `BASE_URL` | `https://modelhub.org.cn` | ModelHub 服务地址。 |
| `BATCH_SIZE` | `50` | 每个停止请求包含的任务数。 |
| `MAX_RETRIES` | `3` | 单批任务的最大请求次数。 |
| `REQUEST_TIMEOUT` | `30` | 单次请求超时(秒)。 |
| `PORT` | `8080` | HTTP 服务端口。 |
## 平台运行接口
- `GET /health`:存活探针,成功返回 `{"status":"ok"}`
- `GET /status`:返回执行阶段、成功/失败数量、失败的任务 ID 与错误信息。
## 运行与构建
仓库根目录的 `Dockerfile` 使用平台 Python 基础镜像,暴露 `8080` 端口并以 `python main.py` 启动。策略构建时请将 `XC_TOKEN``USER_PASSWORD` 都设置为机密变量;构建成功后,策略会先分页读取当前账号的全部任务,仅筛选状态为 `waiting` 的任务再分批停止。
本地验证:
```bash
export XC_TOKEN='***'
export USER_PASSWORD='***'
python main.py
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/status
```