This is an automated email from the ASF dual-hosted git repository. kaxilnaik pushed a commit to branch v3-1-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 243212e6561301841d8f94b7aa436c38249ce2a7 Author: Kaxil Naik <[email protected]> AuthorDate: Tue Sep 23 04:36:42 2025 +0100 Fix `breeze run` command to respect `--backend` flag (#55977) (cherry picked from commit f9b94829b40760c7fcdc5167d94e6b6f8b612a12) --- .../src/airflow_breeze/commands/developer_commands.py | 2 ++ .../src/airflow_breeze/utils/docker_command_utils.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dev/breeze/src/airflow_breeze/commands/developer_commands.py b/dev/breeze/src/airflow_breeze/commands/developer_commands.py index 763f9c52881..476f9249146 100644 --- a/dev/breeze/src/airflow_breeze/commands/developer_commands.py +++ b/dev/breeze/src/airflow_breeze/commands/developer_commands.py @@ -1153,6 +1153,8 @@ def run( shell_params=shell_params, project_name=unique_project_name, command=full_command, + # Always preserve the backend specified by user (or resolved from default) + preserve_backend=True, ) # Clean up ownership diff --git a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py index b959d53fc04..4ea42e1adfb 100644 --- a/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py +++ b/dev/breeze/src/airflow_breeze/utils/docker_command_utils.py @@ -730,13 +730,14 @@ def execute_command_in_shell( command: str | None = None, output: Output | None = None, signal_error: bool = True, + preserve_backend: bool = False, ) -> RunCommandResult: """Executes command in shell. When you want to execute a script/bash command inside the CI container and want to use `enter_shell` for this purpose, the helper methods sets the following parameters of shell_params: - * backend - to force sqlite backend + * backend - to force sqlite backend (unless preserve_backend=True) * clean_sql_db=True - to clean the sqlite DB * forward_ports=False - to avoid forwarding ports from the container to the host - again that will allow to avoid clashes with other commands and opened breeze shell @@ -751,16 +752,23 @@ def execute_command_in_shell( :param project_name: Name of the project to use. This avoids name clashes with default 'breeze" project name used - this way you will be able to run the command in parallel to regular "breeze" shell opened in parallel - :param command: + :param command: command to execute in the shell + :param output: output configuration + :param signal_error: whether to signal error + :param preserve_backend: if True, preserve the backend specified in shell_params instead of forcing sqlite """ - shell_params.backend = "sqlite" + if not preserve_backend: + shell_params.backend = "sqlite" shell_params.forward_ports = False shell_params.project_name = project_name shell_params.quiet = True shell_params.skip_environment_initialization = True shell_params.skip_image_upgrade_check = True if get_verbose(): - get_console().print("[warning]Sqlite DB is cleaned[/]") + if not preserve_backend: + get_console().print("[warning]Sqlite DB is cleaned[/]") + else: + get_console().print(f"[info]Using backend: {shell_params.backend}[/]") get_console().print("[warning]Disabled port forwarding[/]") get_console().print(f"[warning]Project name set to: {project_name}[/]") get_console().print("[warning]Forced quiet mode[/]")
