This is an automated email from the ASF dual-hosted git repository.
gopidesu 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 e41e33bed5b Remove unused function from docker-test utils (#53648)
e41e33bed5b is described below
commit e41e33bed5b9897a297451295a9e0f589a70df88
Author: GPK <[email protected]>
AuthorDate: Tue Jul 22 22:18:43 2025 +0100
Remove unused function from docker-test utils (#53648)
---
docker-tests/tests/docker_tests/docker_utils.py | 39 -------------------------
1 file changed, 39 deletions(-)
diff --git a/docker-tests/tests/docker_tests/docker_utils.py
b/docker-tests/tests/docker_tests/docker_utils.py
index e2c2a421656..fc21a3ae53c 100644
--- a/docker-tests/tests/docker_tests/docker_utils.py
+++ b/docker-tests/tests/docker_tests/docker_utils.py
@@ -17,10 +17,8 @@
from __future__ import annotations
import os
-from time import monotonic, sleep
from python_on_whales import docker
-from python_on_whales.exceptions import NoSuchContainer
from docker_tests.constants import DEFAULT_DOCKER_IMAGE
@@ -96,40 +94,3 @@ Production image:
***** End of the instructions ****
"""
)
-
-
-def wait_for_container(container_id: str, timeout: int = 300):
- print(f"Waiting for container: [{container_id}] for {timeout} more
seconds.")
- start_time = monotonic()
- while True:
- if timeout != 0 and monotonic() - start_time > timeout:
- err_msg = f"Timeout. The operation takes longer than the maximum
waiting time ({timeout}s)"
- raise TimeoutError(err_msg)
-
- try:
- container = docker.container.inspect(container_id)
- except NoSuchContainer:
- msg = f"Container ID {container_id!r} not found."
- if timeout != 0:
- msg += f"\nWaiting for {int(timeout - (monotonic() -
start_time))} more seconds"
- print(msg)
- sleep(5)
- continue
-
- container_msg = f"Container {container.name}[{container_id}]"
- if (state := container.state).status in ("running", "restarting"):
- if state.health is None or state.health.status == "healthy":
- print(
- f"{container_msg}. Status: {state.status!r}. "
- f"Healthcheck: {state.health.status if state.health else
'not set'!r}"
- )
- break
- elif state.status == "exited":
- print(f"{container_msg}. Status: {state.status!r}. Exit Code:
{state.exit_code}")
- break
-
- msg = f"{container_msg} has state:\n {state}"
- if timeout != 0:
- msg += f"\nWaiting for {int(timeout - (monotonic() - start_time))}
more seconds"
- print(msg)
- sleep(1)