nathadfield commented on code in PR #63884:
URL: https://github.com/apache/airflow/pull/63884#discussion_r3008253414


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -91,6 +91,25 @@
 
 log = structlog.get_logger(__name__)
 
+
+def _resolve_run_on_latest_version(
+    explicit_value: bool | None,
+    dag_id: str,
+    session: Session,
+) -> bool:
+    """Resolve run_on_latest_version: explicit > DAG-level > global config > 
False."""
+    if explicit_value is not None:
+        return explicit_value
+    from airflow.models.serialized_dag import SerializedDagModel
+
+    serialized = SerializedDagModel.get_dag(dag_id, session=session)
+    if serialized and serialized.rerun_with_latest_version is not None:
+        return serialized.rerun_with_latest_version
+    from airflow.configuration import conf
+
+    return conf.getboolean("core", "rerun_with_latest_version", fallback=False)
+

Review Comment:
   Good point. I've moved `resolve_run_on_latest_version` to 
`services/public/dag_run.py`. Both the dag_run and task_instances routes now 
import from there.



-- 
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]

Reply via email to