You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/17 11:02:37 UTC
[GitHub] [airflow] ephraimbuddy commented on a change in pull request #9329: [WIP] Pool CRUD Endpoints
ephraimbuddy commented on a change in pull request #9329:
URL: https://github.com/apache/airflow/pull/9329#discussion_r441463109
##########
File path: airflow/api_connexion/endpoints/pool_endpoint.py
##########
@@ -16,18 +16,32 @@
# under the License.
from flask import request
+from connexion import NoContent
+
from airflow.api_connexion import parameters
-from airflow.api_connexion.exceptions import NotFound
-from airflow.api_connexion.schemas.pool_schema import PoolCollection, pool_collection_schema, pool_schema
+from airflow.api_connexion.exceptions import NotFound, AlreadyExists
+from airflow.api_connexion.schemas.pool_schema import (
+ PoolCollection,
+ pool_collection_schema,
+ pool_schema,
+)
from airflow.models.pool import Pool
from airflow.utils.session import provide_session
-def delete_pool():
+@provide_session
+def delete_pool(pool_name, session):
"""
Delete a pool
"""
- raise NotImplementedError("Not implemented yet.")
+ pool_id = pool_name
+ query = session.query(Pool)
+ obj = query.filter(Pool.pool == pool_id).one_or_none()
+
+ if obj is None:
Review comment:
```suggestion
obj = session.query(Pool).filter(Pool.pool == pool_name).one_or_none()
if obj is None:
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org