Copilot commented on code in PR #53368:
URL: https://github.com/apache/airflow/pull/53368#discussion_r2594686671
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/job.py:
##########
@@ -459,8 +450,9 @@ def get_pods(
label_selector = self._build_find_pod_label_selector(context,
exclude_checked=exclude_checked)
pod_list: Sequence[k8s.V1Pod] = []
retry_number: int = 0
+ parallelism = self.parallelism or 1 # Default to using single pod
parallelism
- while len(pod_list) != self.parallelism or retry_number <=
self.discover_pods_retry_number:
+ while len(pod_list) != parallelism or retry_number <=
self.discover_pods_retry_number:
Review Comment:
The while loop condition uses `or` but should use `and`. With the current
logic, the loop will continue as long as either `len(pod_list) != parallelism`
OR `retry_number <= self.discover_pods_retry_number` is true. This means:
1. If pods are found matching the parallelism count, the loop continues as
long as `retry_number <= self.discover_pods_retry_number`
2. If the retry number exceeds the limit but pods don't match, it still
continues
The correct logic should be: `while len(pod_list) != parallelism and
retry_number <= self.discover_pods_retry_number:` to retry finding pods until
either the expected count is found OR the retry limit is reached.
```suggestion
while len(pod_list) != parallelism and retry_number <=
self.discover_pods_retry_number:
```
--
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]