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


##########
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:
   Probably needs to be moved to the service layer. 



##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -545,6 +548,9 @@ def __rich_repr__(self):
     disable_bundle_versioning: bool = attrs.field(
         factory=_config_bool_factory("dag_processor", 
"disable_bundle_versioning")
     )
+    rerun_with_latest_version: bool | None = attrs.field(

Review Comment:
   Is this backward comp between sdk and core version ?



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