Skip to content

Suspend Airflow API endpoint #23337

@jaketf

Description

@jaketf

Description

add a global /suspend and /resume endpoint to the REST API (and corresponding CLI command) that would do the following for the entire airflow deployment:

/suspend

  • pause all currently unpaused DAGs (keeping track of what was previously unpaused in the metadata db)
  • Set AIRFLOW__SCHEDULER__USE_JOB_SCHEDULE=False (if not already false) to prevent scheduler from scheduling more tasks
  • (should handle duplicate suspend calls by 409: Airflow is already suspended)

/resume

  • unpause all DAGs from a previous /suspend call
  • set AIRFLOW__SCHEDULER__USE_JOB_SCHEDULE to whatever it was before the last /suspend call
  • (should handle resuming an airflow that is not in the suspended state with 409: Cannot resume an airflow that is not in suspended state)

Use case/motivation

This could be really helpful for people wanting to pause everything:

  • before running and upgrade to a newer airflow version
  • because this is a dev enviornment and we don't need anything to run outside of working hours to reduce resource consumption
  • "archiving an airflow" call suspend then tear down all the airflow components, could be restored by bringing up the components and then calling resume.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions