YARN-9482. DistributedShell job with localization fails in unsecure cluster. Contributed by Prabhu Joseph.

This commit is contained in:
Giovanni Matteo Fumarola 2019-05-23 13:27:52 -07:00
parent b4b9120e28
commit 6a0e7dd454

View File

@ -774,15 +774,25 @@ private void printUsage(Options opts) {
}
private void cleanup() {
Path dst = null;
try {
appSubmitterUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
FileSystem fs = FileSystem.get(conf);
dst = new Path(fs.getHomeDirectory(), getRelativePath(appName,
appId.toString(), ""));
Path dst = new Path(getAppSubmitterHomeDir(),
getRelativePath(appName, appId.toString(), ""));
fs.delete(dst, true);
} catch(IOException e) {
LOG.warn("Failed to remove application staging directory {}", dst);
return null;
}
});
} catch(Exception e) {
LOG.warn("Failed to remove application staging directory", e);
}
}
private Path getAppSubmitterHomeDir() {
return new Path("/user/" +
System.getenv(ApplicationConstants.Environment.USER.name()));
}
/**
@ -1485,7 +1495,7 @@ public void run() {
String relativePath =
getRelativePath(appName, appId.toString(), fileName);
Path dst =
new Path(fs.getHomeDirectory(), relativePath);
new Path(getAppSubmitterHomeDir(), relativePath);
FileStatus fileStatus = fs.getFileStatus(dst);
LocalResource localRes = LocalResource.newInstance(
URL.fromURI(dst.toUri()),