execgo-runtime 快速开始
构建并启动 execgo-runtime,提交任务,查看状态与 artifact,并接入 ExecGo 控制面。
execgo-runtime 是 ExecGo 生态的数据面运行时。它接收明确的任务请求,负责进程级执行、状态持久化、取消、事件记录、资源留出与 artifact 审计。
当前 runtime 主要面向 Linux 与 macOS 开发和运行;完整 sandbox / cgroup 能力只在 Linux 上可用。
1. 构建与测试
cargo build --release
cargo test2. 启动 HTTP 服务
cargo run -- serve --listen-addr 127.0.0.1:8080 --data-dir ./data启动后会在 ./data 下创建 runtime.db 与 tasks/<task_id>/ 目录,用于保存任务元数据、请求、结果和日志。
3. 提交一个任务
cargo run -- run --json '{
"execution": {
"kind": "command",
"program": "/bin/sh",
"args": ["-c", "echo hello-runtime"]
},
"limits": {
"wall_time_ms": 30000,
"stdout_max_bytes": 65536,
"stderr_max_bytes": 65536
},
"metadata": {
"purpose": "quickstart"
}
}'run 会提交任务并等待终态。需要分步操作时,可以使用 submit、status、wait、kill 等子命令;完整参数见 CLI 文档。
4. 查看结果与 artifact
curl -sS http://127.0.0.1:8080/api/v1/runtime/info
curl -sS http://127.0.0.1:8080/api/v1/runtime/capabilities
curl -sS http://127.0.0.1:8080/api/v1/tasks/<task_id>
ls -la ./data/tasks/<task_id>每个任务目录通常包含:
request.json:提交时的原始请求。result.json:终态结果、退出码与错误信息。stdout.log/stderr.log:子进程输出。
5. 接入 ExecGo 控制面
在 ExecGo 控制面进程中设置 runtime 根地址:
export EXECGO_RUNTIME_URL=http://127.0.0.1:8080之后 ExecGo 的 runtime executor 会通过 runtime HTTP API 提交、轮询和取消任务。建议先阅读 API 文档 与 ExecGo 和 execgo-runtime 的关系,再进入部署环境。