SamWheating commented on a change in pull request #21829:
URL: https://github.com/apache/airflow/pull/21829#discussion_r815347290
##########
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 think either way is fine, but looking into it more I think that most
other DAG parser failure modes (ImportError, Syntax Errors,
AirflowClusterPolicyViolation, etc) will fail on the first error, os we should
probably do the same here.
--
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]