feat: run fixed research pipelines within durable budgets
This commit is contained in:
@@ -458,3 +458,38 @@ class ResearchParent(Base):
|
||||
child_id: Mapped[str] = mapped_column(ForeignKey("research_experiments.id"), primary_key=True)
|
||||
parent_kind: Mapped[str] = mapped_column(String(30), primary_key=True)
|
||||
parent_id: Mapped[str] = mapped_column(String(100), primary_key=True, index=True)
|
||||
|
||||
|
||||
class ResearchFlowRun(Base):
|
||||
"""A user's finite authorization plus an immutable workflow and scope snapshot."""
|
||||
|
||||
__tablename__ = "research_flow_runs"
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True)
|
||||
request_id: Mapped[str] = mapped_column(String(100), unique=True)
|
||||
name: Mapped[str] = mapped_column(String(200))
|
||||
definition: Mapped[dict] = mapped_column(JSON)
|
||||
authorization: Mapped[dict] = mapped_column(JSON)
|
||||
model_revision: Mapped[int | None] = mapped_column(Integer)
|
||||
status: Mapped[str] = mapped_column(String(30), default="queued", index=True)
|
||||
version: Mapped[int] = mapped_column(Integer, default=1)
|
||||
round: Mapped[int] = mapped_column(Integer, default=1)
|
||||
simulations_used: Mapped[int] = mapped_column(Integer, default=0)
|
||||
model_calls_used: Mapped[int] = mapped_column(Integer, default=0)
|
||||
error: Mapped[str | None] = mapped_column(Text)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
|
||||
|
||||
|
||||
class ResearchStepRun(Base):
|
||||
__tablename__ = "research_step_runs"
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True)
|
||||
run_id: Mapped[str] = mapped_column(ForeignKey("research_flow_runs.id"), index=True)
|
||||
node_id: Mapped[str] = mapped_column(String(100))
|
||||
round: Mapped[int] = mapped_column(Integer)
|
||||
status: Mapped[str] = mapped_column(String(30), default="running")
|
||||
output: Mapped[dict] = mapped_column(JSON, default=dict)
|
||||
backtest_run_id: Mapped[str | None] = mapped_column(ForeignKey("backtest_runs.id"))
|
||||
error: Mapped[str | None] = mapped_column(Text)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=now)
|
||||
__table_args__ = (UniqueConstraint("run_id", "node_id", "round"),)
|
||||
|
||||
Reference in New Issue
Block a user