amoghrajesh commented on code in PR #40909:
URL: https://github.com/apache/airflow/pull/40909#discussion_r1691984534
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -721,14 +721,27 @@ def read_pod(self, pod: V1Pod) -> V1Pod:
except HTTPError as e:
raise AirflowException(f"There was an error reading the kubernetes
API: {e}")
- def await_xcom_sidecar_container_start(self, pod: V1Pod) -> None:
+ def await_xcom_sidecar_container_start(self, pod: V1Pod, startup_timeout:
int = 120) -> None:
+ """
+ Await xcom sidecar container to start running.
+
+ :param pod:
+ :param startup_timeout: Timeout (in seconds) for startup of the pod
+ """
self.log.info("Checking if xcom sidecar container is started.")
+ curr_time = time.time()
for attempt in itertools.count():
if self.container_is_running(pod,
PodDefaults.SIDECAR_CONTAINER_NAME):
self.log.info("The xcom sidecar container is started.")
break
if not attempt:
self.log.warning("The xcom sidecar container is not yet
started.")
+ if time.time() - curr_time >= startup_timeout:
+ msg = (
+ f"Xcom sidecar container took longer than
{startup_timeout} seconds to start. "
+ "Check the container events in kubernetes to determine
why."
+ )
Review Comment:
Can we just dump the events as well? That would be a better indicator than
users manually checking in k8s
##########
airflow/providers/cncf/kubernetes/utils/pod_manager.py:
##########
@@ -721,14 +721,27 @@ def read_pod(self, pod: V1Pod) -> V1Pod:
except HTTPError as e:
raise AirflowException(f"There was an error reading the kubernetes
API: {e}")
- def await_xcom_sidecar_container_start(self, pod: V1Pod) -> None:
+ def await_xcom_sidecar_container_start(self, pod: V1Pod, startup_timeout:
int = 120) -> None:
Review Comment:
Can we add test cases for this change? Like basically call this, sleep for
certain seconds and then check if the exception came up
--
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]