You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/07 03:53:45 UTC

[GitHub] [flink] zuston commented on a diff in pull request #17958: FLINK-25029: Hadoop Caller Context Setting in Flink

zuston commented on code in PR #17958:
URL: https://github.com/apache/flink/pull/17958#discussion_r844622564


##########
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java:
##########
@@ -432,6 +434,19 @@ public Task(
 
         // finally, create the executing thread, but do not start it
         executingThread = new Thread(TASK_THREADS_GROUP, this, taskNameWithSubtask);
+
+        // Add CallerContext.
+        String callerContext =
+                "Flink_Task_"
+                        + "JobID_"
+                        + jobId
+                        + "_TaskName_"
+                        + taskInfo.getTaskName()
+                        + "_"
+                        + taskInfo.getAttemptNumber();
+
+        HadoopFsFactory.setCurrent(
+                tmConfig.getOptional(HadoopOptions.CALLER_CONTEXT_APP_ID).orElse(callerContext));

Review Comment:
   Using `orElseGet` directly maybe better? 
   
   If `CALLER_CONTEXT_APP_ID` exist, there's no need to construct the `callContext` var.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org