Skip to content

Commit

Permalink
Update schemas to support async runs (#477)
Browse files Browse the repository at this point in the history
* Update schemas

* Keep run_id for backwards compatibility
  • Loading branch information
rossgray authored Jul 31, 2024
1 parent 32382ba commit f680b7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions pipeline/cloud/schemas/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,16 @@ class ContainerRunError(BaseModel):

class ContainerRunCreate(BaseModel):
# run_id is optional since it's just used for attaching logs to a run
run_id: t.Optional[str]
inputs: t.List[RunInput]
run_id: str | None
inputs: list[RunInput]
async_run: bool = False
callback_url: str | None


class ContainerRunResult(BaseModel):
inputs: t.Optional[t.List[RunInput]]
outputs: t.Optional[t.List[RunOutput]]
error: t.Optional[ContainerRunError]
inputs: list[RunInput] | None
outputs: list[RunOutput] | None
error: ContainerRunError | None

def outputs_formatted(self) -> t.List[t.Any]:
outputs = self.outputs or []
Expand Down Expand Up @@ -319,10 +321,14 @@ class RunStateTransitions(BaseModel):
data: t.List[RunStateTransition]


class RunCreate(ContainerRunCreate):
class RunCreate(BaseModel):
# pipeline id or pointer
pipeline: str
inputs: list[RunInput]
async_run: bool = False
# flag to determine whether the run will wait for compute resources to be
# become available if none are currently running the pipeline
wait_for_resources: bool | None = None
# run_id is not used and should not be provided (it is kept here for
# backwards compatibility)
run_id: str | None = None
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pipeline-ai"
version = "2.5.0"
version = "2.5.1"
description = "Pipelines for machine learning workloads."
authors = [
"Paul Hetherington <ph@mystic.ai>",
Expand Down

0 comments on commit f680b7e

Please sign in to comment.