jinglining commented on a change in pull request #11250: [FLINK-16302][rest]add log list and read log by name for taskmanager URL: https://github.com/apache/flink/pull/11250#discussion_r394367376
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java ########## @@ -915,29 +936,21 @@ public void heartbeatFromResourceManager(ResourceID resourceID) { default: filePath = null; } + return requestFileUploadByFilePath(filePath, timeout, fileType.toString()); + } - if (filePath != null && !filePath.isEmpty()) { - final File file = new File(filePath); - - if (file.exists()) { - final TransientBlobCache transientBlobService = blobCacheService.getTransientBlobService(); - final TransientBlobKey transientBlobKey; - try (FileInputStream fileInputStream = new FileInputStream(file)) { - transientBlobKey = transientBlobService.putTransient(fileInputStream); - } catch (IOException e) { - log.debug("Could not upload file {}.", fileType, e); - return FutureUtils.completedExceptionally(new FlinkException("Could not upload file " + fileType + '.', e)); - } + @Override + public CompletableFuture<TransientBlobKey> requestFileUploadByName(String fileName, Time timeout) { + log.debug("Request file name is {} upload.", fileName); - return CompletableFuture.completedFuture(transientBlobKey); - } else { - log.debug("The file {} does not exist on the TaskExecutor {}.", fileType, getResourceID()); - return FutureUtils.completedExceptionally(new FlinkException("The file " + fileType + " does not exist on the TaskExecutor.")); - } + final String filePath; + final String logDir = taskManagerConfiguration.getTaskManagerLogDir(); + if (logDir != null && !logDir.isEmpty() && fileName != null && !fileName.isEmpty()) { + filePath = logDir + "/" + fileName; Review comment: maybe below code is better: ```java filePath = Paths.get(logDir, fileName).toFile().getAbsolutePath(); ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services