Gallardot commented on code in PR #14379:
URL: 
https://github.com/apache/dolphinscheduler/pull/14379#discussion_r1260449862


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java:
##########
@@ -327,7 +327,7 @@ private void collectPodLogIfNeeded() {
             ThreadUtils.sleep(SLEEP_TIME_MILLIS * 5L);
             try (
                     LogWatch watcher = 
ProcessUtils.getPodLogWatcher(taskRequest.getK8sTaskExecutionContext(),
-                            taskRequest.getTaskAppId())) {
+                            taskRequest.getTaskAppId(), "")) {

Review Comment:
   Why is it an empty string?



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/am/KubernetesApplicationManager.java:
##########
@@ -97,16 +101,20 @@ public ResourceManagerType getResourceManagerType() {
      * @param kubernetesApplicationManagerContext
      * @return
      */
-    private FilterWatchListDeletable<Pod, PodList, PodResource> 
getDriverPod(KubernetesApplicationManagerContext 
kubernetesApplicationManagerContext) {
+    private FilterWatchListDeletable<Pod, PodList, PodResource> 
getListenPod(KubernetesApplicationManagerContext 
kubernetesApplicationManagerContext) {
         KubernetesClient client = 
getClient(kubernetesApplicationManagerContext);
         String labelValue = 
kubernetesApplicationManagerContext.getLabelValue();
-        FilterWatchListDeletable<Pod, PodList, PodResource> watchList = 
client.pods()
-                
.inNamespace(kubernetesApplicationManagerContext.getK8sTaskExecutionContext().getNamespace())
-                .withLabel(UNIQUE_LABEL_NAME, labelValue);
-        List<Pod> podList = watchList.list().getItems();
-        if (podList.size() != 1) {
-            log.warn("Expected driver pod 1, but get {}.", podList.size());
+        List<Pod> podList = null;
+        FilterWatchListDeletable<Pod, PodList, PodResource> watchList = null;
+        int retryTimes = 0;
+        while (CollectionUtils.isEmpty(podList) && retryTimes < 
MAX_RETRY_TIMES) {
+            watchList = client.pods()
+                    
.inNamespace(kubernetesApplicationManagerContext.getK8sTaskExecutionContext().getNamespace())
+                    .withLabel(UNIQUE_LABEL_NAME, labelValue);
+            podList = watchList.list().getItems();
+            retryTimes += 1;

Review Comment:
   LGTM, while adding `thread.sleep` might be better.



-- 
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]

Reply via email to