This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new a8f511cc291 Adjust Timeout Action in Breeze Testing Command (#44802)
a8f511cc291 is described below
commit a8f511cc29193f7549074384bdbf33ab7a6c4261
Author: Bugra Ozturk <[email protected]>
AuthorDate: Tue Dec 10 13:21:34 2024 +0100
Adjust Timeout Action in Breeze Testing Command (#44802)
* Change sys.exit to kill all docker container
* Split list and kill containers, include signal to containers to not fall
in SIGTERM:137 but fall in SIGALRM:142, test locally
* Update dev/breeze/src/airflow_breeze/commands/testing_commands.py
* Update dev/breeze/src/airflow_breeze/commands/testing_commands.py
---------
Co-authored-by: Jarek Potiuk <[email protected]>
---
.../src/airflow_breeze/commands/testing_commands.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index ba651f5067f..a9297cb6132 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -1118,8 +1118,19 @@ def python_api_client_tests(
@contextlib.contextmanager
def run_with_timeout(timeout: int):
def timeout_handler(signum, frame):
- get_console().print("[error]Timeout reached. Killing the process[/]")
- sys.exit(1)
+ get_console().print("[error]Timeout reached. Killing the
container(s)[/]")
+ list_of_containers = run_command(
+ ["docker", "ps", "-q"],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+ run_command(
+ ["docker", "kill", "--signal", "SIGQUIT"] +
list_of_containers.stdout.splitlines(),
+ check=True,
+ capture_output=False,
+ text=True,
+ )
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(timeout)