YARN-9482. DistributedShell job with localization fails in unsecure cluster. Contributed by Prabhu Joseph.
This commit is contained in:
parent
b4b9120e28
commit
6a0e7dd454
|
@ -774,17 +774,27 @@ public class ApplicationMaster {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanup() {
|
private void cleanup() {
|
||||||
Path dst = null;
|
|
||||||
try {
|
try {
|
||||||
FileSystem fs = FileSystem.get(conf);
|
appSubmitterUgi.doAs(new PrivilegedExceptionAction<Void>() {
|
||||||
dst = new Path(fs.getHomeDirectory(), getRelativePath(appName,
|
@Override
|
||||||
appId.toString(), ""));
|
public Void run() throws IOException {
|
||||||
fs.delete(dst, true);
|
FileSystem fs = FileSystem.get(conf);
|
||||||
} catch(IOException e) {
|
Path dst = new Path(getAppSubmitterHomeDir(),
|
||||||
LOG.warn("Failed to remove application staging directory {}", dst);
|
getRelativePath(appName, appId.toString(), ""));
|
||||||
|
fs.delete(dst, true);
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main run function for the application master
|
* Main run function for the application master
|
||||||
*
|
*
|
||||||
|
@ -1485,7 +1495,7 @@ public class ApplicationMaster {
|
||||||
String relativePath =
|
String relativePath =
|
||||||
getRelativePath(appName, appId.toString(), fileName);
|
getRelativePath(appName, appId.toString(), fileName);
|
||||||
Path dst =
|
Path dst =
|
||||||
new Path(fs.getHomeDirectory(), relativePath);
|
new Path(getAppSubmitterHomeDir(), relativePath);
|
||||||
FileStatus fileStatus = fs.getFileStatus(dst);
|
FileStatus fileStatus = fs.getFileStatus(dst);
|
||||||
LocalResource localRes = LocalResource.newInstance(
|
LocalResource localRes = LocalResource.newInstance(
|
||||||
URL.fromURI(dst.toUri()),
|
URL.fromURI(dst.toUri()),
|
||||||
|
|
Loading…
Reference in New Issue