ManiBharataraju commented on a change in pull request #16508:
URL: https://github.com/apache/airflow/pull/16508#discussion_r670194063
##########
File path: airflow/models/dag.py
##########
@@ -1847,7 +1847,10 @@ def bulk_write_to_db(cls, dags: Collection["DAG"],
session=None):
for missing_dag_id in missing_dag_ids:
orm_dag = DagModel(dag_id=missing_dag_id)
dag = dag_by_ids[missing_dag_id]
- if dag.is_paused_upon_creation is not None:
+
+ if dag.is_subdag:
+ orm_dag.is_paused = dag.parent_dag.get_is_paused()
+ elif dag.is_paused_upon_creation is not None:
Review comment:
@uranusjr - Okay. So what is happening is, let's say you create a dag
and deploy it and it is running. At a later point, you want to add an
enhancement to the dag which is a subdag. You would expect the subdag to run in
the next schedule. However, what is happening is, the newly added subdag is
created in off state because `is_paused_upon_creation` by default is True. My
PR fixes this issue by checking the status of the parent dag for such cases
only.
The workaround for this currently is, turn off the parent dag and turn it
back on so that both the parent and subdag is in the same state.
> When a parent DAG is set to pause, its subdags should also be paused?
This is currently working fine and this PR does not change anything wrt this.
If you still have questions, I can ping you over the slack channel. Thanks!
--
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]