uranusjr commented on code in PR #30117:
URL: https://github.com/apache/airflow/pull/30117#discussion_r1142984921
##########
airflow/cli/commands/dag_command.py:
##########
@@ -296,36 +295,22 @@ def dag_next_execution(args):
print("[INFO] Please be reminded this DAG is PAUSED now.",
file=sys.stderr)
with create_session() as session:
- max_date_subq = (
- session.query(func.max(DagRun.execution_date).label("max_date"))
- .filter(DagRun.dag_id == dag.dag_id)
- .subquery()
- )
- max_date_run: DagRun | None = (
- session.query(DagRun)
- .filter(DagRun.dag_id == dag.dag_id, DagRun.execution_date ==
max_date_subq.c.max_date)
- .one_or_none()
- )
-
- if max_date_run is None:
- print("[WARN] Only applicable when there is execution record found
for the DAG.", file=sys.stderr)
+ last_parsed_dag: DagModel =
session.query(DagModel).filter(DagModel.dag_id == dag.dag_id).one()
+
+ next_interval = dag.get_next_data_interval(last_parsed_dag)
+ for i in range(args.num_executions):
+ if i != 0:
+ next_info = dag.next_dagrun_info(next_interval, restricted=False)
+ next_interval = None if next_info is None else
next_info.data_interval
Review Comment:
Hmm, I think I prefer the previous `range(1, num)` way.
--
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]