Skip to content

Commit

Permalink
apply dag attributes to dag model instead of other way around
Browse files Browse the repository at this point in the history
  • Loading branch information
RNHTTR committed Nov 9, 2023
1 parent fa2be24 commit ba19765
Show file tree
Hide file tree
Showing 5 changed files with 1,015 additions and 1,034 deletions.
12 changes: 6 additions & 6 deletions airflow/api_connexion/endpoints/dag_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ def get_dag(*, dag_id: str, session: Session = NEW_SESSION) -> APIResponse:


@security.requires_access_dag("GET")
def get_dag_details(*, dag_id: str) -> APIResponse:
def get_dag_details(*, dag_id: str, session: Session = NEW_SESSION) -> APIResponse:
"""Get details of DAG."""
dag: DAG = get_airflow_app().dag_bag.get_dag(dag_id)
if not dag:
raise NotFound("DAG not found", detail=f"The DAG with dag_id: {dag_id} was not found")
dag_model: DagModel = DagModel.get_dagmodel(dag_id=dag_id)
for key, value in dag_model.__dict__.items():
if not key.startswith("_") and not hasattr(dag, key):
setattr(dag, key, value)
dag_model: DagModel = session.get(DagModel, dag_id)
for key, value in dag.__dict__.items():
if not key.startswith("_") and not hasattr(dag_model, key):
setattr(dag_model, key, value)

return dag_detail_schema.dump(dag)
return dag_detail_schema.dump(dag_model)


@security.requires_access_dag("GET")
Expand Down
Loading

0 comments on commit ba19765

Please # to comment.