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/21 08:57:35 UTC
[GitHub] [airflow] mik-laj commented on a change in pull request #9329: Pool CRUD Endpoints
mik-laj commented on a change in pull request #9329:
URL: https://github.com/apache/airflow/pull/9329#discussion_r443198113
##########
File path: airflow/api_connexion/endpoints/pool_endpoint.py
##########
@@ -14,61 +14,91 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from flask import request
+from flask import Response, request
from sqlalchemy import func
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: str, session) -> Response:
"""
Delete a pool
"""
- raise NotImplementedError("Not implemented yet.")
+ if session.query(Pool).filter(Pool.pool == pool_name).delete() == 0:
+ raise NotFound("Pool not found")
+ return Response(status=204)
@provide_session
-def get_pool(pool_name, session):
+def get_pool(pool_name, session) -> Response:
Review comment:
```suggestion
def get_pool(pool_name, session):
```
It seems to me that this is not true. mypy doesn't raise error because it got lost in types, but we return the dictionary from this function.
----------------------------------------------------------------
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