Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api add support bulk pause resume #19758

Merged

Conversation

megan-parker
Copy link
Contributor

@megan-parker megan-parker commented Nov 22, 2021

Endpoint for Bulk Updates to DAGs

Currently the Airflow REST API only allows us to pause/resume (update) one DAG per request. We often need to pause/resume DAGs in bulk. To avoid maintaining a separate set of custom endpoints that will be fragile, it makes sense to update the patch_dag endpoint to handle bulk requests.

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Nov 22, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 22, 2021

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from c5255de to bff0351 Compare November 23, 2021 18:12
@megan-parker megan-parker marked this pull request as ready for review November 23, 2021 18:16
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/endpoints/dag_endpoint.py Outdated Show resolved Hide resolved
airflow/api_connexion/openapi/v1.yaml Outdated Show resolved Hide resolved
@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from 730ce99 to f5d042d Compare December 14, 2021 23:46
@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch 2 times, most recently from 2e88ce4 to d95b6a3 Compare January 12, 2022 16:12
@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from d95b6a3 to 6dea9f2 Compare January 24, 2022 13:53
@megan-parker
Copy link
Contributor Author

@ephraimbuddy could you please review again?

@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from 6dea9f2 to d0060d3 Compare February 3, 2022 14:54
@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from d0060d3 to 7c512f2 Compare March 2, 2022 15:15
Copy link
Contributor

@ephraimbuddy ephraimbuddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks good. Yea, the dag_id_pattern is required on the patch endpoint but not required on get endpoint. I suggest to only work on the patch endpoint in this PR and work on the get endpoint in a separate PR.

airflow/api_connexion/openapi/v1.yaml Show resolved Hide resolved
airflow/api_connexion/openapi/v1.yaml Show resolved Hide resolved
airflow/api_connexion/openapi/v1.yaml Show resolved Hide resolved
airflow/api_connexion/openapi/v1.yaml Outdated Show resolved Hide resolved
@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from 7c512f2 to bc8d9ba Compare March 9, 2022 15:57
Copy link
Contributor

@ephraimbuddy ephraimbuddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
One more ask, add a test to validate that the dag_id_pattern is required for this endpoint to avoid someone removing it in the future

@megan-parker megan-parker force-pushed the api-add-support-bulk-pause-resume branch from 9025937 to 2ee1ee9 Compare March 10, 2022 13:56
@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Mar 10, 2022
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@ephraimbuddy ephraimbuddy requested review from uranusjr and ashb March 11, 2022 06:31
@ephraimbuddy ephraimbuddy added this to the Airflow 2.3.0 milestone Mar 14, 2022
@ephraimbuddy ephraimbuddy merged commit 408a7d6 into apache:main Mar 14, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 14, 2022

Awesome work, congrats on your first merged pull request!

@ephraimbuddy ephraimbuddy added the type:new-feature Changelog: New Features label Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API okay to merge It's ok to merge this PR as it does not require more tests type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants