bugraoz93 commented on code in PR #66261: URL: https://github.com/apache/airflow/pull/66261#discussion_r3369380035
########## airflow-core/src/airflow/api/client/local_client.py: ########## @@ -19,22 +19,77 @@ from __future__ import annotations +import json +from datetime import datetime +from typing import Any + import httpx +from airflowctl.api.client import ClientKind as AirflowCtlClientKind, ServerResponseError, provide_api_client +from airflowctl.api.datamodels.generated import PoolBody, TriggerDAGRunPostBody +from airflowctl.exceptions import AirflowCtlConnectionException +from pydantic import BaseModel, ConfigDict, Field, ValidationError as PydanticValidationError from airflow.api.common import delete_dag, trigger_dag +from airflow.api_fastapi.app import get_auth_manager, init_auth_manager +from airflow.api_fastapi.auth.managers.simple.user import SimpleAuthManagerUser +from airflow.configuration import conf from airflow.exceptions import AirflowBadRequest, PoolNotFound from airflow.models.pool import Pool +from airflow.utils.platform import getuser from airflow.utils.types import DagRunTriggeredByType +class LocalDagRunResponse(BaseModel): + """Dag Run response returned by the local fallback client.""" + + model_config = ConfigDict(from_attributes=True, populate_by_name=True) + + conf: dict[str, Any] | None + dag_id: str + dag_run_id: str = Field(validation_alias="run_id") + data_interval_start: datetime | None + data_interval_end: datetime | None + end_date: datetime | None + last_scheduling_decision: datetime | None + logical_date: datetime | None + run_type: str + start_date: datetime | None + state: str + triggering_user_name: str | None + + Review Comment: We are still creating new client here and it is not even airflowctl driven child class. We should create airflowctl client. What i mean singleton client is airflowctl client va generated token and all of them using single aggregation object even though we don't change class structure but since we are changing we shpuld do that those are consequences of using singleton airflowctl rather maintaining huge class here as we are currently have those in ctl with exception handled. We should revise accordingly and use api datamodels -- 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]
