Make the gunicorn API server respect GUNICORN_CMD_ARGS again#62522
Make the gunicorn API server respect GUNICORN_CMD_ARGS again#62522ashb merged 1 commit intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores support for the GUNICORN_CMD_ARGS environment variable in the Airflow API server when using gunicorn. This functionality was broken after the introduction of a custom Arbiter in PR #60940, which bypassed gunicorn's normal CLI parsing. The fix manually invokes gunicorn's environment variable parsing API to respect user-provided gunicorn arguments.
Changes:
- Modified
load_config()to parse and applyGUNICORN_CMD_ARGSenvironment variable settings - Added comprehensive test coverage for the new functionality including precedence rules
- Ensured environment variables override programmatic options (consistent with standard behavior)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| airflow-core/src/airflow/api_fastapi/gunicorn_app.py | Added code to parse GUNICORN_CMD_ARGS and apply settings to gunicorn config |
| airflow-core/tests/unit/cli/commands/test_gunicorn_monitor.py | Added three tests verifying config loading, GUNICORN_CMD_ARGS support, and precedence rules |
Since our new Arbiter and custom code doesn't invoke Gunicorn via the full CLI path of normal gunicorn, we have to manually call this. This lets us give control to users to accept any and all gunicorn args without us having to put them in our CLI, or keep up to date with changes. This env var is something stock `gunicorn` already respects too.
cd0921e to
5c5175b
Compare
Backport failed to create: v3-1-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 67a86d5 v3-1-testThis should apply the commit to the v3-1-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
|
Hi maintainer, this PR was merged without a milestone set.
|
…62522) Since our new Arbiter and custom code doesn't invoke Gunicorn via the full CLI path of normal gunicorn, we have to manually call this. This lets us give control to users to accept any and all gunicorn args without us having to put them in our CLI, or keep up to date with changes. This env var is something stock `gunicorn` already respects too.
Since our new Arbiter and custom code added in #60940 doesn't invoke Gunicorn via the full CLI path of normal gunicorn, we have to manually call this.
This lets us give control to users to accept any and all gunicorn args without us having to put them in our CLI, or keep up to date with changes. This env var is something stock
gunicornalready respects too.Tested with
AIRFLOW__API__SERVER_TYPE=gunicorn GUNICORN_CMD_ARGS="--max-requests 2" airflow api-serverAnd then after two requests we see this: