[ 
https://issues.apache.org/jira/browse/YARN-11196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17581173#comment-17581173
 ] 

ASF GitHub Bot commented on YARN-11196:
---------------------------------------

PrabhuJoseph commented on code in PR #4742:
URL: https://github.com/apache/hadoop/pull/4742#discussion_r948694728


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java:
##########
@@ -364,33 +376,68 @@ public int relaunchContainer(ContainerStartContext ctx)
    * Create a new {@link ShellCommandExecutor} using the parameters.
    *
    * @param wrapperScriptPath the path to the script to execute
-   * @param containerIdStr the container ID
+   * @param container the container reference
    * @param user the application owner's username
    * @param pidFile the path to the container's PID file
-   * @param resource this parameter controls memory and CPU limits.
    * @param workDir If not-null, specifies the directory which should be set
    * as the current working directory for the command. If null,
    * the current working directory is not modified.
-   * @param environment the container environment
    * @return the new {@link ShellCommandExecutor}
    * @see ShellCommandExecutor
    */
   protected CommandExecutor buildCommandExecutor(String wrapperScriptPath, 
-      String containerIdStr, String user, Path pidFile, Resource resource,
-      File workDir, Map<String, String> environment) {
-    
+      Container container, String user, Path pidFile, File workDir) {
+
+    String containerIdStr = container.getContainerId().toString();
+    Resource resource = container.getResource();
     String[] command = getRunCommand(wrapperScriptPath,
         containerIdStr, user, pidFile, this.getConf(), resource);
 
+    if(numaAwarenessEnabled(this.getConf())) {
+      try {
+        numaResourceAllocator.init(this.getConf());
+        command = addNumaCommands(command, container);
+      } catch (YarnException e) {
+        LOG.warn("Exception :- ", e);
+        LOG.warn("Initializing container without NUMA.");
+      }
+    }
     LOG.info("launchContainer: {}", Arrays.toString(command));
     return new ShellCommandExecutor(
         command,
         workDir,
-        environment,
+            container.getLaunchContext().getEnvironment(),
         0L,
         false);
   }
 
+  String[] addNumaCommands(String[] commands, Container container){
+    try {
+      NumaResourceAllocation numaAllocation = 
numaResourceAllocator.allocateNumaNodes(container);

Review Comment:
   Launch Container has to release the NUMA Resources at finally.





> NUMA Awareness support in DefaultContainerExecutor
> --------------------------------------------------
>
>                 Key: YARN-11196
>                 URL: https://issues.apache.org/jira/browse/YARN-11196
>             Project: Hadoop YARN
>          Issue Type: Improvement
>          Components: nodemanager
>    Affects Versions: 3.3.3
>            Reporter: Prabhu Joseph
>            Assignee: Samrat Deb
>            Priority: Major
>              Labels: pull-request-available
>
> [YARN-5764|https://issues.apache.org/jira/browse/YARN-5764] has added support 
> of NUMA Awareness for Containers launched through LinuxContainerExecutor. 
> This feature is useful to have in DefaultContainerExecutor as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to