This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9356233762 Avoid initiating session twice in dag_next_execution 
(#35539)
9356233762 is described below

commit 9356233762a67c0a787fc3e16040455019af13bd
Author: Phong Bui <[email protected]>
AuthorDate: Thu Nov 9 07:56:44 2023 +0700

    Avoid initiating session twice in dag_next_execution (#35539)
---
 airflow/cli/commands/dag_command.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/airflow/cli/commands/dag_command.py 
b/airflow/cli/commands/dag_command.py
index 064da35df1..74609c41dc 100644
--- a/airflow/cli/commands/dag_command.py
+++ b/airflow/cli/commands/dag_command.py
@@ -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(

Reply via email to