kaxil commented on code in PR #49544:
URL: https://github.com/apache/airflow/pull/49544#discussion_r2053897815
##########
providers/standard/src/airflow/providers/standard/operators/latest_only.py:
##########
@@ -62,54 +60,39 @@ def choose_branch(self, context: Context) -> str |
Iterable[str]:
dag_run: DagRun = context["dag_run"] # type: ignore[assignment]
if dag_run.run_type == DagRunType.MANUAL:
self.log.info("Manually triggered DAG_Run: allowing execution to
proceed.")
- return
list(context["task"].get_direct_relative_ids(upstream=False))
+ return list(self.get_direct_relative_ids(upstream=False))
- next_info = self._get_next_run_info(context, dag_run)
- now = pendulum.now("UTC")
+ next_info = self._get_next_run_info(dag_run)
if next_info is None:
self.log.info("Last scheduled execution: allowing execution to
proceed.")
- return
list(context["task"].get_direct_relative_ids(upstream=False))
-
- left_window, right_window = next_info.data_interval
- self.log.info(
- "Checking latest only with left_window: %s right_window: %s now:
%s",
- left_window,
- right_window,
- now,
- )
-
- if left_window == right_window:
- self.log.info(
- "Zero-length interval [%s, %s) from timetable (%s); treating
current run as latest.",
- left_window,
- right_window,
- self.dag.timetable.__class__,
- )
- return
list(context["task"].get_direct_relative_ids(upstream=False))
+ return list(self.get_direct_relative_ids(upstream=False))
- if not left_window < now <= right_window:
Review Comment:
The change looks correct, but I have no idea why `now` was ever used
--
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]