shahar1 commented on code in PR #53368:
URL: https://github.com/apache/airflow/pull/53368#discussion_r2213620150
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_job.py:
##########
@@ -949,4 +979,4 @@ def test_update_execute(self, mock_patch_namespaced_job,
mock_load_kube_config):
op.execute(None)
- mock_patch_namespaced_job.assert_called()
+ mock_patch_namespaced_job.assert_called()
Review Comment:
Please adda new line
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/job.py:
##########
@@ -147,6 +152,33 @@ def create_job(self, job_request_obj: k8s.V1Job) ->
k8s.V1Job:
return job_request_obj
+ def get_or_create_pod(self, pod_request_obj, context):
+ """Polls for pods created by the job object
+
+ Parameters
+ ----------
+ pod_request_obj : V1Pod
+ Kubernetes Pod object definition
+ context : Context
+ Airflow context
+
+ Returns
+ -------
+ V1Pod
+ Kubernetes Pod object from cluster hook
+ """
+ pod = None
+ with timeout(seconds=self.pod_creation_timeout,
error_message="Exceeded pod_creation_timeout."):
+ while pod is None:
+ try:
+ pod = self.find_pod(self.namespace or
pod_request_obj.metadata.namespace, context=context)
+ except ApiException:
+ log.exception("Error getting pod - retrying")
+ time.sleep(1)
Review Comment:
Maybe make the sleeping time configurable?
--
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]