Lee-W commented on code in PR #52051:
URL: https://github.com/apache/airflow/pull/52051#discussion_r2163068418
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py:
##########
@@ -293,10 +293,24 @@ def client(self) -> CoreV1Api:
def custom_obj_api(self) -> CustomObjectsApi:
return CustomObjectsApi()
+ def update_pod_spec_add_xcom_sidecar(self):
Review Comment:
```suggestion
def update_pod_spec_add_xcom_sidecar(self) -> None:
```
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/xcom_sidecar.py:
##########
@@ -46,7 +50,7 @@ class PodDefaults:
def add_xcom_sidecar(
- pod: k8s.V1Pod,
+ pod: Union[k8s.V1Pod, dict],
Review Comment:
```suggestion
pod: k8s.V1Pod | dict,
```
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/spark_kubernetes.py:
##########
@@ -293,10 +293,24 @@ def client(self) -> CoreV1Api:
def custom_obj_api(self) -> CustomObjectsApi:
return CustomObjectsApi()
+ def update_pod_spec_add_xcom_sidecar(self):
+ if self.do_xcom_push:
+ try:
+ self.log.debug("Adding xcom sidecar to driver pod spec in task
%s", self.task_id)
+ driver_template = self.template_body["spark"]["spec"]
+ driver_with_xcom_template =
add_sidecar_to_spark_operator_pod_spec(
+ driver_template,
+
sidecar_container_image=self.hook.get_xcom_sidecar_container_image(),
+
sidecar_container_resources=self.hook.get_xcom_sidecar_container_resources(),
+ )
+ self.template_body["spark"]["spec"]= driver_with_xcom_template
+ except KeyError as e:
+ raise AirflowException("Spec missing in SparkApplication
template") from e
Review Comment:
let's not use `AirflowException`, we can create a customized exception or
just use KeyError
--
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]