potiuk commented on code in PR #44802:
URL: https://github.com/apache/airflow/pull/44802#discussion_r1877994324
##########
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", "SIGALRM"] +
list_of_containers.stdout.splitlines(),
Review Comment:
Just one thing - it should be sigquit - as it is the hardest of ignorable
signals - sigalrm is just timer (and we use it to start the handler after some
time, but in order to `kill` a process that is misbehaving it's best to send
SIGQUIT. We could also send SIGKILL after a timeout (which will hard-kill the
processes no matter what), but that should really be needed only in
extraordinary cases - and we can add signal escalation (that is how it is
called) later when needed. IT would require to wait for all the processes to
shudown for some time (10 - 20 seconds) and send SIGKILL if they are still
there. But let's hope it's not going to be needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]