jason810496 commented on code in PR #46484:
URL: https://github.com/apache/airflow/pull/46484#discussion_r1966491458
##########
tests/api_fastapi/core_api/routes/public/test_dag_run.py:
##########
@@ -146,14 +148,41 @@ def setup(request, dag_maker, session=None):
)
dag_maker.sync_dagbag_to_db()
- dag_maker.dag_model
dag_maker.dag_model.has_task_concurrency_limits = True
session.merge(ti1)
session.merge(ti2)
session.merge(dag_maker.dag_model)
session.commit()
+def get_dag_versions_dict(dag_version: DagVersion):
+ return DagVersionResponse.model_validate(dag_version,
from_attributes=True).model_dump(mode="json")
+
+
+def get_dag_run_dict(run: DagRun):
+ return {
+ "dag_run_id": run.run_id,
+ "dag_id": run.dag_id,
+ "logical_date": from_datetime_to_zulu_without_ms(run.logical_date),
+ "queued_at": from_datetime_to_zulu(run.queued_at) if run.queued_at
else None,
+ "run_after": from_datetime_to_zulu_without_ms(run.run_after),
+ "start_date": from_datetime_to_zulu_without_ms(run.start_date),
+ "end_date": from_datetime_to_zulu(run.end_date),
+ "data_interval_start":
from_datetime_to_zulu_without_ms(run.data_interval_start),
+ "data_interval_end":
from_datetime_to_zulu_without_ms(run.data_interval_end),
+ "last_scheduling_decision": (
+ from_datetime_to_zulu(run.last_scheduling_decision) if
run.last_scheduling_decision else None
+ ),
+ "run_type": run.run_type,
+ "state": run.state,
+ "external_trigger": run.external_trigger,
+ "triggered_by": run.triggered_by.value,
+ "conf": run.conf,
+ "note": run.note,
+ "dag_versions": [get_dag_versions_dict(dag_version) for dag_version in
run.dag_versions],
Review Comment:
Sure, I just refactored the `get_dag_versions_dict`.
--
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]