uranusjr commented on a change in pull request #21829:
URL: https://github.com/apache/airflow/pull/21829#discussion_r815897214
##########
File path: airflow/models/dag.py
##########
@@ -2625,6 +2625,17 @@ 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)}
+ task_pools = {task.pool for task in self.tasks}
+ diff = task_pools - pools
+ if diff:
+ raise PoolNotFound(f"The following pools: `{list(diff)}` does not
exist in the database")
Review comment:
```suggestion
raise PoolNotFound(f"The following pools: `{sorted(diff)}` does
not exist in the database")
```
For predicability.
##########
File path: airflow/models/dag.py
##########
@@ -2625,6 +2625,17 @@ 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)}
+ task_pools = {task.pool for task in self.tasks}
+ diff = task_pools - pools
+ if diff:
+ raise PoolNotFound(f"The following pools: `{list(diff)}` does not
exist in the database")
Review comment:
```suggestion
raise PoolNotFound(f"The following pools: `{sorted(diff)}` do
not exist in the database")
```
For predicability.
--
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]