guan404ming commented on code in PR #50443:
URL: https://github.com/apache/airflow/pull/50443#discussion_r2113827559
##########
kubernetes-tests/tests/kubernetes_tests/test_base.py:
##########
@@ -232,20 +232,44 @@ def ensure_resource_health(
resource_name: str,
namespace: str = "airflow",
resource_type: Literal["deployment", "statefulset"] = "deployment",
+ max_retries: int = 3,
+ timeout_seconds: int = 5,
):
"""Watch the resource until it is healthy.
Args:
resource_name (str): Name of the resource to check.
resource_type (str): Type of the resource (e.g., deployment,
statefulset).
namespace (str): Kubernetes namespace where the resource is
located.
+ max_retries (int): Maximum number of retries.
+ timeout_seconds (int): Timeout in seconds for each attempt.
"""
- rollout_status = check_output(
- ["kubectl", "rollout", "status",
f"{resource_type}/{resource_name}", "-n", namespace, "--watch"],
- ).decode()
- if resource_type == "deployment":
- assert "successfully rolled out" in rollout_status
- else:
- assert "roll out complete" in rollout_status
+ for attempt in range(max_retries):
+ try:
+ rollout_status = check_output(
+ [
+ "kubectl",
+ "rollout",
+ "status",
+ f"{resource_type}/{resource_name}",
+ "-n",
Review Comment:
Sure, I would remove it now.
--
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]