ephraimbuddy commented on a change in pull request #21829:
URL: https://github.com/apache/airflow/pull/21829#discussion_r815274573



##########
File path: airflow/models/dag.py
##########
@@ -2625,6 +2625,18 @@ def validate_schedule_and_params(self):
                     "DAG Schedule must be None, if there are any required 
params without default values"
                 )
 
+    @provide_session
+    def validate_task_pools(self, session=NEW_SESSION):
+        """Validates and raise exception if any task in a dag is using a 
non-existent pool"""
+        from airflow.models.pool import Pool
+
+        pools = [p.pool for p in Pool.get_pools(session)]
+        for task in self.tasks:
+            if task.pool not in pools:
+                raise PoolNotFound(

Review comment:
       I thought about that and feel that failing as fast as possible would be 
faster because a dag may have a lot of tasks and walking through all the tasks 
is likely to take time. WDYT?




-- 
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]


Reply via email to