bbovenzi commented on code in PR #44246:
URL: https://github.com/apache/airflow/pull/44246#discussion_r1852645251
##########
airflow/api_fastapi/core_api/datamodels/task_instances.py:
##########
@@ -150,3 +151,44 @@ class TaskInstanceHistoryCollectionResponse(BaseModel):
task_instances: list[TaskInstanceHistoryResponse]
total_entries: int
+
+
+class SetTaskInstancesStateBody(BaseModel):
+ """Request body for Set Task Instances State endpoint."""
+
+ dry_run: bool = True
+ task_id: str
+ dag_run_id: str
+ include_upstream: bool
+ include_downstream: bool
+ include_future: bool
+ include_past: bool
+ new_state: str
+
+ @field_validator("new_state", mode="before")
+ @classmethod
+ def validate_new_state(cls, ns: str) -> str:
+ """Validate new_state."""
+ valid_states = [
+ vs.name.lower()
+ for vs in (TaskInstanceState.SUCCESS, TaskInstanceState.FAILED,
TaskInstanceState.SKIPPED)
+ ]
+ ns = ns.lower()
+ if ns not in valid_states:
+ raise ValueError(f"'{ns}' is not one of {valid_states}")
+ return ns
+
+
+class TaskInstanceReferenceResponse(BaseModel):
+ """Task Instance Reference serializer for responses."""
+
+ task_id: str
+ dag_run_id: str = Field(validation_alias="run_id")
+ dag_id: str
+ logical_date: datetime
Review Comment:
logical_date is no longer unique. Is it still necessary for serializing?
@dstandish
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]