V2 独立版愿景
配置说明
HeteroFlow 是本站的异构算力与大模型调度产品。配置说明。配置说明 HeteroFlow V2 通过 config.yaml 配置文件和环境变量进行配置。 配置文件 config.yaml 完整配置 环境变量 认证相关 变量 说明 默认值 ------ ------ -------- HETEROFLOW JWT SECRET JWT…
配置说明
HeteroFlow V2 通过 config.yaml 配置文件和环境变量进行配置。
配置文件
config.yaml 完整配置
server:
port: 3333 # Server 监听端口
host: 0.0.0.0 # 监听地址
mode: release # 运行模式:debug/release
storage:
type: postgresql # 存储类型:postgresql/sqlite
postgresql:
host: localhost
port: 5432
database: heteroflow
user: heteroflow
password: heteroflow2024
ssl_mode: disable
max_open_conns: 25 # 最大连接数
max_idle_conns: 5 # 最大空闲连接
conn_max_lifetime: 1800 # 连接最大生命周期(秒)
sqlite:
path: heteroflow.db # SQLite 文件路径
auth:
jwt_secret: "your-secret" # JWT 签名密钥
expire_hours: 72 # Token 有效期
scheduler:
schedule_interval: 5 # 调度间隔(秒)
queue_capacity: 1000 # 队列容量
default_task_timeout: 1800 # 默认任务超时(秒)
gpu_reserve_fixed_mb: 500 # GPU 预留显存(MB)
gpu_reserve_percent: 10 # GPU 预留显存比例
plugins:
pre_score: [Preempt]
filter: [ResourceFilter, GPUFilter]
score: [Binpack, Spread, NVLink]
bind: [DefaultBind]
load_thresholds:
gpu_memory_percent: 95 # GPU 显存使用率阈值
gpu_utilization_percent: 95 # GPU 利用率阈值
cpu_percent: 90 # CPU 使用率阈值
memory_percent: 90 # 内存使用率阈值
gpu_temperature_threshold: 79 # GPU 温度阈值
alerts:
rules:
- id: rule-1
name: GPU使用率告警
type: GPU_HIGH
threshold: 90
enabled: true
- id: rule-2
name: 内存使用率告警
type: MEMORY_HIGH
threshold: 85
enabled: true环境变量
认证相关
| 变量 | 说明 | 默认值 |
|---|---|---|
| HETEROFLOW_JWT_SECRET | JWT 签名密钥(≥32字符) | 自动生成 64 字节随机密钥 |
| HETEROFLOW_TOKEN_EXPIRY | Token 有效期(Go duration) | 24h |
| HETEROFLOW_AGENT_API_KEY | Agent API 密钥 | 自动生成 32 字节随机密钥 |
| HETEROFLOW_ENV | 运行环境(development/production) | development |
CORS 相关
| 变量 | 说明 | 默认值 |
|---|---|---|
| CORS_ALLOWED_ORIGINS | CORS 允许的额外来源(逗号分隔) | - |
| DEBUG / DEV_MODE | 开发模式标志 | false |
Agent 相关
| 变量 | 说明 | 默认值 |
|---|---|---|
| HETEROFLOW_SERVER_URL | Server 地址 | 配置文件 |
| HETEROFLOW_API_KEY | API 密钥 | - |
| HETEROFLOW_NODE_ID | 节点 ID | hostname |
| HETEROFLOW_MODEL_CACHE_DIR | 模型缓存目录 | /data/heteroflow/model-cache |
| HETEROFLOW_MODEL_SCAN_DIRS | 扫描目录(逗号分隔) | 缓存目录 |
| HETEROFLOW_ALLOWED_VOLUME_PREFIXES | 允许挂载的路径前缀 | 6 个默认路径 |
| HETEROFLOW_DENIED_VOLUME_PREFIXES | 禁止挂载的路径前缀 | 6 个系统路径 |
存储后端选择
| 类型 | 适用场景 | 特点 |
|---|---|---|
| SQLite | 裸金属部署,小规模(≤5节点) | 零配置,单文件 |
| PostgreSQL | 生产环境,高并发(>5节点) | 高性能,支持集群 |
调度器配置
插件配置
调度器每个阶段可配置不同的插件:
scheduler:
plugins:
pre_score: [Preempt] # 抢占预处理
filter: [ResourceFilter, GPUFilter] # 资源/GPU 过滤
score: [Binpack, Spread, NVLink] # 打分策略
bind: [DefaultBind] # 资源绑定负载阈值
当节点资源超过以下阈值时不接受新任务:
| 阈值 | 默认值 | 说明 |
|---|---|---|
| gpu_memory_percent | 95% | GPU 显存使用率 |
| gpu_utilization_percent | 95% | GPU 计算利用率 |
| cpu_percent | 90% | CPU 使用率 |
| memory_percent | 90% | 内存使用率 |
| gpu_temperature_threshold | 79°C | GPU 温度 |
可通过 API 动态更新:PUT /api/v1/scheduler/config
Agent 配置
agent-config.json
{
"server_url": "http://server:3333",
"node_id": "gpu-node-1",
"heartbeat_interval": 10,
"task_check_interval": 10,
"gpu_type": "nvidia",
"docker_mode": "native",
"task_exec_mode": "docker",
"agent_secret": "secret",
"engine_priorities": {
"nvidia": ["vllm", "sglang", "llamacpp"]
},
"model_cache_dir": "/data/heteroflow/model-cache",
"model_scan_dirs": ["/data", "/root/models", "/workspace"],
"allowed_volume_prefixes": ["/data/", "/home/", "/opt/", "/workspace/"],
"denied_volume_prefixes": ["/etc", "/proc", "/sys", "/dev"]
}引擎优先级配置
{
"engine_priorities": {
"nvidia": ["vllm", "sglang", "llamacpp"],
"hygon": ["vllm", "llamacpp"],
"ascend": ["mindie"],
"musa": ["vllm-mtt"]
}
}