Coverage for /home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/datamodels/task_instance_history.py: 100%
37 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 14:22 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 14:22 +0000
1# Licensed to the Apache Software Foundation (ASF) under one
2# or more contributor license agreements. See the NOTICE file
3# distributed with this work for additional information
4# regarding copyright ownership. The ASF licenses this file
5# to you under the Apache License, Version 2.0 (the
6# "License"); you may not use this file except in compliance
7# with the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing,
12# software distributed under the License is distributed on an
13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14# KIND, either express or implied. See the License for the
15# specific language governing permissions and limitations
16# under the License.
17from __future__ import annotations
19from datetime import datetime
20from typing import Annotated
22from pydantic import (
23 AliasPath,
24 BeforeValidator,
25 Field,
26)
28from airflow.api_fastapi.core_api.base import BaseModel
29from airflow.api_fastapi.core_api.datamodels.dag_versions import DagVersionResponse
30from airflow.utils.state import TaskInstanceState
33class TaskInstanceHistoryResponse(BaseModel):
34 """TaskInstanceHistory serializer for responses."""
36 task_id: str
37 dag_id: str
39 # todo: this should not be aliased; it's ambiguous with dag run's "id" - airflow 3.0
40 run_id: str = Field(alias="dag_run_id")
42 map_index: int
43 start_date: datetime | None
44 end_date: datetime | None
45 duration: float | None
46 state: TaskInstanceState | None
47 try_number: int
48 max_tries: int
49 task_display_name: str
50 dag_display_name: str = Field(validation_alias=AliasPath("dag_run", "dag_model", "dag_display_name"))
51 hostname: str | None
52 unixname: str | None
53 pool: str
54 pool_slots: int
55 queue: str | None
56 priority_weight: int | None
57 operator: str | None
58 custom_operator_name: str | None = Field(alias="operator_name")
59 queued_dttm: datetime | None = Field(alias="queued_when")
60 scheduled_dttm: datetime | None = Field(alias="scheduled_when")
61 pid: int | None
62 executor: str | None
63 executor_config: Annotated[str, BeforeValidator(str)]
64 dag_version: DagVersionResponse | None
67class TaskInstanceHistoryCollectionResponse(BaseModel):
68 """TaskInstanceHistory Collection serializer for responses."""
70 task_instances: list[TaskInstanceHistoryResponse]
71 total_entries: int