You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pankajastro (via GitHub)" <gi...@apache.org> on 2023/06/27 19:33:35 UTC

[GitHub] [airflow] pankajastro commented on a diff in pull request #32000: Fix DAG test command stuck in infinite loop

pankajastro commented on code in PR #32000:
URL: https://github.com/apache/airflow/pull/32000#discussion_r1244252381


##########
airflow/models/dag.py:
##########
@@ -2645,6 +2645,13 @@ def test(
         :param variable_file_path: file path to a variable file in either yaml or json
         :param session: database connection (optional)
         """
+        # If DAG is paused, unpaused it to avoid test being stuck in case of deferrable operator or retry.
+        if self.is_paused:
+            self.log.info("The DAG %s is paused. Unpausing it.", self.dag_id)
+            session.query(DagModel).filter(DagModel.dag_id == self.dag_id).update(
+                {DagModel.is_paused: False, DagModel.is_active: True}

Review Comment:
   right, I do not need to update `is_active` to pause dag. Thank you!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org