Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,42 @@ def validate_model(cls, data: Any) -> Any:
return data


class DagRunIdentifier(StrictBaseModel):
"""Identifier for a Dag run targeted by a bulk operation."""

dag_run_id: str
dag_id: str | None = None


class BulkDagRunBody(DagRunIdentifier, DAGRunPatchBody):
"""Request body for bulk update and delete Dag runs (patch fields plus run identity)."""


class BulkClearDagRunsBody(StrictBaseModel):
"""Request body for the bulk clear Dag runs endpoint."""

runs: list[DagRunIdentifier]
only_failed: bool = False
only_new: bool = Field(
default=False,
description="Only queue newly added tasks in the latest Dag version without clearing existing tasks.",
)
run_on_latest_version: bool = Field(
default=False,
description="(Experimental) Run on the latest bundle version of the Dag after clearing the Dag Run.",
)
dry_run: bool = True
note: str | None = Field(default=None, max_length=1000)

@model_validator(mode="before")
@classmethod
def validate_model(cls, data: Any) -> Any:
"""Validate clear Dag runs form."""
if data.get("only_new") and data.get("only_failed"):
raise ValueError("only_new and only_failed are mutually exclusive")
return data


class DAGRunResponse(BaseModel):
"""Dag Run serializer for responses."""

Expand Down
Loading
Loading