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


##########
airflow-core/src/airflow/api_fastapi/core_api/services/public/dag_run.py:
##########
@@ -86,3 +89,17 @@ async def wait(self) -> AsyncGenerator[str, None]:
             await asyncio.sleep(self.interval)
             yield await self._serialize_response(dag_run := await 
self._get_dag_run())
             yield "\n"
+
+
+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
+    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
+    return conf.getboolean("core", "rerun_with_latest_version", fallback=False)

Review Comment:
   The SerializedDagModel.get_dag call is lightweight (single row lookup by 
primary key) and clearing is an infrequent user-initiated operation. Threading 
a pre-fetched value through would add complexity to every caller for a marginal 
performance gain. Happy to revisit if profiling shows this is a bottleneck.



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