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

Bikas Saha commented on YARN-593:
---------------------------------

>From 
>https://issues.apache.org/jira/browse/MAPREDUCE-4987?focusedCommentId=13636643&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13636643
bq.bq. This logic iterates over multiple distinct localized resources, 
potentially a mix of file and directories, so we need to check isDirectory for 
each one.

By definition the key value of the entry set does not need to be checked for 
isDir for every linkName in the list of values for that key.

{code}
+        for (Map.Entry<Path,List<String>> entry : resources.entrySet()) {
+          for (String linkName : entry.getValue()) {
+            // Append resource.
+            newClassPath.append(File.pathSeparator).append(pwd.toString())
+              .append(Path.SEPARATOR).append(linkName);
+
+            // FileUtil.createJarWithClassPath must use File.toURI to convert
+            // each file to a URI to write into the manifest's classpath.  For
+            // directories, the classpath must have a trailing '/', but
+            // File.toURI only appends the trailing '/' if it is a directory 
that
+            // already exists.  To resolve this, add the classpath entries with
+            // explicit trailing '/' here for any localized resource that 
targets
+            // a directory.  Then, FileUtil.createJarWithClassPath will 
guarantee
+            // that the resulting entry in the manifest's classpath will have a
+            // trailing '/', and thus refer to a directory instead of a file.
+            if (new File(entry.getKey().toUri().getPath()).isDirectory()) {   
<-----------
+              newClassPath.append(Path.SEPARATOR);
+            }
+          }
+        }
{code}
                
> container launch on Windows does not correctly populate classpath with new 
> process's environment variables and localized resources
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-593
>                 URL: https://issues.apache.org/jira/browse/YARN-593
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: nodemanager
>    Affects Versions: 3.0.0
>            Reporter: Chris Nauroth
>            Assignee: Chris Nauroth
>         Attachments: YARN-593.1.patch
>
>
> On Windows, we must bundle the classpath of a launched container in an 
> intermediate jar with a manifest.  Currently, this logic incorrectly uses the 
> nodemanager process's environment variables for substitution.  Instead, it 
> needs to use the new environment for the launched process.  Also, the bundled 
> classpath is missing some localized resources for directories, due to a quirk 
> in the way {{File#toURI}} decides whether or not to append a trailing '/'.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to