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 2021/12/07 07:35:09 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #19758: Api add support bulk pause resume

uranusjr commented on a change in pull request #19758:
URL: https://github.com/apache/airflow/pull/19758#discussion_r763707903



##########
File path: airflow/api_connexion/endpoints/dag_endpoint.py
##########
@@ -88,25 +88,67 @@ def get_dags(limit, session, offset=0, only_active=True, tags=None, dag_id_patte
 @provide_session
 def patch_dag(session, dag_id, update_mask=None):
     """Update the specific DAG"""
+    try:
+        patch_body = dag_schema.load(request.json, session=session)
+    except ValidationError as err:
+        raise BadRequest(detail=str(err.messages))
+    if update_mask:
+        patch_body_ = {}
+        if update_mask != ['is_paused']:
+            raise BadRequest(detail="Only `is_paused` field can be updated through the REST API")
+        update_mask = update_mask[0]
+        patch_body_[update_mask] = patch_body[update_mask]

Review comment:
       ```suggestion
           if update_mask != ['is_paused']:
               raise BadRequest(detail="Only `is_paused` field can be updated through the REST API")
           patch_body_[update_mask[0]] = patch_body[update_mask[0]]
   ```
   
   Pre-emptively fix the Mypy issue that eventually needs to be fixed by the ongoing Mypy-enabling effort 🙂 




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org