Skip to content

Commit

Permalink
Avoid initiating session twice in dag_next_execution (apache#35539)
Browse files Browse the repository at this point in the history
  • Loading branch information
boushphong authored and romsharon98 committed Nov 10, 2023
1 parent bc2d694 commit 29f5c02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions airflow/cli/commands/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,14 @@ def dag_next_execution(args) -> None:
"""
dag = get_dag(args.subdir, args.dag_id)

if dag.get_is_paused():
print("[INFO] Please be reminded this DAG is PAUSED now.", file=sys.stderr)

with create_session() as session:
last_parsed_dag: DagModel = session.scalars(
select(DagModel).where(DagModel.dag_id == dag.dag_id)
).one()

if last_parsed_dag.get_is_paused():
print("[INFO] Please be reminded this DAG is PAUSED now.", file=sys.stderr)

def print_execution_interval(interval: DataInterval | None):
if interval is None:
print(
Expand Down

0 comments on commit 29f5c02

Please sign in to comment.