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

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
 ##########
 @@ -1647,6 +1660,30 @@ private boolean isJobManagerConnectionValid(JobID 
jobId, JobMasterId jobMasterId
                return jmConnection != null && 
Objects.equals(jmConnection.getJobMasterId(), jobMasterId);
        }
 
+       private CompletableFuture<TransientBlobKey> 
requestFileUploadByFilePath(String filePath, Time timeout, String fileTag) {
+               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 {}.", 
fileTag, e);
+                                       return 
FutureUtils.completedExceptionally(new FlinkException("Could not upload file " 
+ fileTag + '.', e));
+                               }
+
+                               return 
CompletableFuture.completedFuture(transientBlobKey);
+                       } else {
+                               log.debug("The file {} does not exist on the 
TaskExecutor {}.", fileTag, getResourceID());
+                               return FutureUtils.completedExceptionally(new 
FlinkException("The file " + fileTag + " does not exist on the TaskExecutor."));
+                       }
+               } else {
+                       log.debug("The file {} unavailable on the TaskExecutor 
{}.", fileTag, getResourceID());
 
 Review comment:
   "The file {} is unavailable on the TaskExecutor"

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to