ruanwenjun commented on code in PR #17510:
URL: 
https://github.com/apache/dolphinscheduler/pull/17510#discussion_r2476452898


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/am/KubernetesApplicationManager.java:
##########
@@ -186,34 +251,39 @@ private TaskExecutionStatus 
getApplicationStatus(KubernetesApplicationManagerCon
     /**
      * get pod's log watcher
      *
-     * @param kubernetesApplicationManagerContext
-     * @return
+     * @param kubernetesApplicationManagerContext Context
+     * @return Watcher
      */
     @SneakyThrows
     public LogWatch getPodLogWatcher(KubernetesApplicationManagerContext 
kubernetesApplicationManagerContext) {
-        KubernetesClient client = 
getClient(kubernetesApplicationManagerContext);
+        KubernetesClient client = null;
         boolean podIsReady = false;
         Pod pod = null;
-        while (!podIsReady) {
-            FilterWatchListDeletable<Pod, PodList, PodResource> watchList =
-                    getListenPod(kubernetesApplicationManagerContext);
-            List<Pod> podList = watchList == null ? null : 
watchList.list().getItems();
-            if (CollectionUtils.isEmpty(podList)) {
-                return null;
-            }
-            pod = podList.get(0);
-            String phase = pod.getStatus().getPhase();
-            if (phase.equals(PENDING) || phase.equals(UNKNOWN)) {
-                Thread.sleep(SLEEP_TIME_MILLIS);
-            } else {
-                podIsReady = true;
+        try {
+            client = getClient(kubernetesApplicationManagerContext);
+            while (!podIsReady) {
+                FilterWatchListDeletable<Pod, PodList, PodResource> watchList =
+                        getListenPod(kubernetesApplicationManagerContext);
+                List<Pod> podList = watchList == null ? null : 
watchList.list().getItems();
+                if (CollectionUtils.isEmpty(podList)) {
+                    return null;
+                }
+                pod = podList.get(0);
+                String phase = pod.getStatus().getPhase();
+                if (phase.equals(PENDING) || phase.equals(UNKNOWN)) {
+                    Thread.sleep(SLEEP_TIME_MILLIS);
+                } else {
+                    podIsReady = true;
+                }
             }
-        }
 
-        return client.pods().inNamespace(pod.getMetadata().getNamespace())
-                .withName(pod.getMetadata().getName())
-                
.inContainer(kubernetesApplicationManagerContext.getContainerName())
-                .watchLog();
+            return client.pods().inNamespace(pod.getMetadata().getNamespace())
+                    .withName(pod.getMetadata().getName())
+                    
.inContainer(kubernetesApplicationManagerContext.getContainerName())
+                    .watchLog();
+        } finally {
+            log.debug("Log watch client is not returned immediately, will be 
managed by caller after watch completes");

Review Comment:
   This log seems meaningless.



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