det101 commented on code in PR #17165:
URL: 
https://github.com/apache/dolphinscheduler/pull/17165#discussion_r2086718346


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/logging/LogClientDelegate.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.api.executor.logging;
+
+import org.apache.dolphinscheduler.dao.entity.TaskInstance;
+import 
org.apache.dolphinscheduler.extract.common.transportor.TaskInstanceLogFileDownloadResponse;
+import 
org.apache.dolphinscheduler.extract.common.transportor.TaskInstanceLogPageQueryResponse;
+import org.apache.dolphinscheduler.plugin.task.api.utils.TaskTypeUtils;
+import org.apache.dolphinscheduler.registry.api.RegistryClient;
+import org.apache.dolphinscheduler.registry.api.enums.RegistryNodeType;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class LogClientDelegate {
+
+    @Autowired
+    private LocalLogClient localLogClient;
+    @Autowired
+    private RemoteLogClient remoteLogClient;
+    @Autowired
+    private RegistryClient registryClient;
+
+    /**
+     * Retrieves a portion of the log string for a given task instance.
+     * This method first attempts to fetch the log from local storage; if 
unsuccessful, it tries to obtain the log from remote storage.
+     *
+     * @param taskInstance The task instance object, containing information 
needed for log retrieval.
+     * @param skipLineNum The number of log lines to skip from the beginning.
+     * @param limit The maximum number of log lines to retrieve.
+     * @return A string containing the specified portion of the log.
+     */
+    public String getPartLogString(TaskInstance taskInstance, int skipLineNum, 
int limit) {
+        checkArgs(taskInstance);
+        checkNodeExists(taskInstance);

Review Comment:
   There is a logic problem here. If the node does not exist, it will neither 
download it locally nor make a remote request. Thank you very much for finding 
this problem. i fix it



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