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/18 07:37:56 UTC

[GitHub] [airflow] OmairK commented on a change in pull request #9329: Pool CRUD Endpoints

OmairK commented on a change in pull request #9329:
URL: https://github.com/apache/airflow/pull/9329#discussion_r442027426



##########
File path: airflow/api_connexion/endpoints/pool_endpoint.py
##########
@@ -14,20 +14,28 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+from connexion import NoContent
 from flask import request
 
 from airflow.api_connexion import parameters
-from airflow.api_connexion.exceptions import NotFound
+from airflow.api_connexion.exceptions import AlreadyExists, NotFound
 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:
+        raise NotFound("Pool not found")
+    session.delete(obj)

Review comment:
       Neat :smile: ! Fixed.




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