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



##########
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:
       In the event of multiple tasks with non-existent pools, is it preferable 
to fail as fast as possible and only warn about the first such occurrence, or 
should we first check all of the tasks and then raise with an error which 
reports all of the issues?
   




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