Skip to content
Merged
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 @@ -53,6 +53,7 @@
from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc
from airflow.api_fastapi.core_api.security import GetUserDep, ReadableTIFilterDep, requires_access_dag
from airflow.api_fastapi.logging.decorators import action_logging
from airflow.models.dag_version import DagVersion
from airflow.models.dagrun import DagRun
from airflow.models.hitl import HITLDetail as HITLDetailModel, HITLUser
from airflow.models.taskinstance import TaskInstance as TI
Expand Down Expand Up @@ -252,8 +253,10 @@ def get_hitl_details(
.join(TI.dag_run)
.options(
joinedload(HITLDetailModel.task_instance).options(
joinedload(TI.dag_run),
)
joinedload(TI.dag_run).joinedload(DagRun.dag_model),
joinedload(TI.task_instance_note),
joinedload(TI.dag_version).joinedload(DagVersion.bundle),
),
)
)
if dag_id != "~":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from airflow.sdk.execution_time.hitl import HITLUser
from airflow.utils.state import TaskInstanceState

from tests_common.test_utils.asserts import assert_queries_count
from tests_common.test_utils.format_datetime import from_datetime_to_zulu_without_ms

if TYPE_CHECKING:
Expand Down Expand Up @@ -526,7 +527,8 @@ def test_should_respond_200_with_existing_response(
test_client: TestClient,
expected_sample_hitl_detail_dict: dict[str, Any],
) -> None:
response = test_client.get("/dags/~/dagRuns/~/hitlDetails")
with assert_queries_count(3):
response = test_client.get("/dags/~/dagRuns/~/hitlDetails")
assert response.status_code == 200
assert response.json() == {
"hitl_details": [expected_sample_hitl_detail_dict],
Expand Down Expand Up @@ -595,7 +597,8 @@ def test_should_respond_200_with_existing_response_and_query(
params: dict[str, Any],
expected_ti_count: int,
) -> None:
response = test_client.get("/dags/~/dagRuns/~/hitlDetails", params=params)
with assert_queries_count(3):
response = test_client.get("/dags/~/dagRuns/~/hitlDetails", params=params)
assert response.status_code == 200
assert response.json()["total_entries"] == expected_ti_count
assert len(response.json()["hitl_details"]) == expected_ti_count
Expand Down