参数模板 Profile
Profile 保存任务参数,提交时冻结实际值。内联 Profile 是 SDK 提交中的字典;命名 Profile 是平台本地 registry 中有名称和版本的参数模板。Profile 不是 Trial,不保存凭据。
Inline parameters
from envloop import Client
with Client.remote() as client:
trial = client.tasks.submit("./my-task", profile={"seed": 42})
print(trial["trial_id"])
Task 入口通过 ENVLOOP_TASK_PROFILE 读取 JSON:
import json
import os
profile = json.loads(os.environ.get("ENVLOOP_TASK_PROFILE", "{}"))
print(profile.get("seed"))
参数由 Task 解释;传 seed 不会自动使脚本、模型或环境确定化。profile 字典与完整 ProfileSpec 不同。
Local named profiles
需要安装 EnvPlatform。以下在用户数据集 Git 仓库顶层执行;示例假设 el 已安装到当前 shell,仓库有本地 main 分支。未初始化 Git 仓库时先准备仓库,不要在 SDK 安装目录误建数据 registry。
unset ENVLOOP_BASE_URL ENVPLATFORM_API_URL
el --repository-root . profile init
cat > spec.json <<'JSON'
{
"schema_version": "envplatform.profile/v1",
"name": "examples/local",
"version": "1",
"params": {"seed": 42, "execution": {"timeout_sec": 60}}
}
JSON
el --repository-root . profile put examples/local 1 --file spec.json
el --repository-root . profile get examples/local --version 1
el --repository-root . task submit ./my-task --profile examples/local@1
my-task 只含任务的两个文件;spec.json 放在任务目录外。Profile 管理不读取 .env.local 的地址,也没有 HTTP 写入口。远程提交引用命名 Profile 时,Profile 必须已经存在于服务端 registry,而不是客户端本地文件。
Defaults and snapshots
el --repository-root . profile set-default examples/local 1
el --repository-root . profile list --name examples/local
el --repository-root . profile export examples/local 1 > exported-profile.json
省略版本需有显式默认,不猜 latest。已有默认时用 --expected-version OLD_VERSION 做并发检查。--profile-sha256 用于校验规范化 ProfileSpec 哈希;--seed 可覆盖运行 seed。
repository 省略 commit 时绑定本地 main 的固定快照,不使用当前工作分支 HEAD,也不自动拉取远端。无 main 或需其他快照时,显式传完整 commit:
el --repository-root . --repository-commit "$(git rev-parse HEAD)" \
task submit ./my-task --profile examples/local@1
同一 repository 的新 Client 可读取已完成回执;运行中任务不跨进程恢复。SDK 方法见 Reference。