jedcunningham commented on code in PR #35316:
URL: https://github.com/apache/airflow/pull/35316#discussion_r1378317608


##########
airflow/models/dag.py:
##########
@@ -746,6 +747,17 @@ def validate_setup_teardown(self):
                         raise ValueError("Setup tasks must be followed with 
trigger rule ALL_SUCCESS.")
             FailStopDagInvalidTriggerRule.check(dag=self, 
trigger_rule=task.trigger_rule)
 
+    def _validate_tasks_not_empty(self):
+        """
+        Validate that this DAG has something in `tasks`.
+
+        Somehow in the wild we've encountered a state where the root taskgroup 
shows a task,
+        but the `tasks` property doesn't. This shouldn't be possible, but when 
it does happen,
+        the scheduler crashes.
+        """
+        if self.task_group.children and not self.tasks:

Review Comment:
   Just realized this does mean this DAG would fail to parse:
   
   ```
   with DAG(
       dag_id="empty_task_group",
       start_date=datetime(2022, 4, 1),
   ) as dag:
       with TaskGroup(group_id="some_task_group") as tg1:
           pass
   ```
   
   Feels odd to need to support DAGs without actual tasks though?



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to