feat: run fixed research pipelines within durable budgets

This commit is contained in:
yuxuanhui
2026-09-08 22:16:05 +08:00
parent eb4850a003
commit 7860434b04
25 changed files with 2357 additions and 37 deletions
+6 -2
View File
@@ -121,14 +121,18 @@ class Experiments:
validation["status"] = "needs_review"
return validation
async def create(self, body, kind="template", extra_evidence=None):
async def create(self, body, kind="template", extra_evidence=None, *, parent_snapshots=None):
asset = await self.assets.get(body.asset_id, body.version, "template") if body.asset_id else None
template = TemplateSpec.model_validate(asset["content"]) if asset else body.template
scope = scope_of(body.settings)
if template.scope and template.scope.model_dump() != scope:
raise HTTPException(422, "模板适用范围与候选设置不同")
snapshots, fields = await self.inputs(body.input_ids, scope)
parents = await self.parents(body.parent_alpha_ids, body.parent_experiment_ids)
parents = (
parent_snapshots
if parent_snapshots is not None
else await self.parents(body.parent_alpha_ids, body.parent_experiment_ids)
)
variables = {}
for name, variable in template.variables.items():
if variable.kind == "field":