Uh oh!
There was an error while loading. Please reload this page.
Respect apps flags for api_server_command - #52929
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ensures the --apps flag is respected outside of dev mode and that the AIRFLOW_API_APPS environment variable is always restored to its original value.
- Introduces a
with_api_apps_envdecorator to manage setting/tearing down the env var - Refactors
api_serverto use the decorator and removes inline env manipulation - Updates
test_api_server_command.pyto parameterize scenarios for dev/non-dev modes and original env states
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| airflow-core/tests/unit/cli/commands/test_api_server_command.py | Parameterize and expand test_api_apps_env to cover all flag permutations and teardown |
| airflow-core/src/airflow/cli/commands/api_server_command.py | Add with_api_apps_env decorator, apply to api_server, remove manual env handling, update type ignore on access_log |
Comments suppressed due to low confidence (1)
airflow-core/tests/unit/cli/commands/test_api_server_command.py:121
- [nitpick] The test verifies that
AIRFLOW_API_APPSis cleaned up, but doesn’t assert that it was initially set to the expected value. Consider adding anassertonmock_environ.__setitem__for the first assignment.
api_server_command.api_server(parsed_args)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
potiuk
left a comment
There was a problem hiding this comment.
I am not sure how much we want to configure apps in prod - I guess we might find it useful in some deployments. But should not we describe it in documentation why to do it and how to do it?
kaxil
commented
Jul 6, 2025
#43103 . Feel free to take it over @jason810496 |
jason810496
commented
Jul 7, 2025
IMO, it might be useful for scaling API server for Task Execution and Core API separately or for users that just need to run Task Execution API-server solely.
Thanks for bringing up the related issue! I will raise another for the documentation side. |
pierrejeambrun
left a comment
There was a problem hiding this comment.
Yes this is useful for people that want to deploy a standalone execution api server. (Scaling, isolation etc.)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
874657d to
900003bCompareUh oh!
There was an error while loading. Please reload this page.
a41c768 to
824b711Compare824b711 to
19d8a8aCompareBackport failed to create: v3-0-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker c0c41ff v3-0-testThis should apply the commit to the v3-0-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 --continue |
* Respect apps flags for api_server_command * Refactor test_api_apps_env
@jason810496 needs manual cherry picking I guess, or this fix won't be in the next patch release. |
jason810496
commented
Jul 15, 2025
Thanks for the reminder! I will raise backport PR when I back to home |
* Respect apps flags for api_server_command * Refactor test_api_apps_env (cherry picked from commit c0c41ff)
kaxil
commented
Jul 15, 2025
Cool, thanks. Please do when you get time
|
* Respect apps flags for api_server_command * Refactor test_api_apps_env (cherry picked from commit c0c41ff)
* Respect apps flags for api_server_command * Refactor test_api_apps_env (cherry picked from commit c0c41ff)
) * Respect apps flags for api_server_command * Refactor test_api_apps_env (cherry picked from commit c0c41ff)
related: #52860
Why
--appsflag with--devmode.AIRFLOW_API_APPSenvironment to specify which apps are going to initialize increate_appcall.AIRFLOW_API_APPSenv is no restored properly, we should set back to original value if it's set before theairlow api-serverrun.What
with_api_apps_envdecorator with proper teardowntest_api_apps_envtest with more scenario including all apps currently available, dev mode or not, and original env is set or not.