/*
* set this user's id in job configuration, so later job files can be
* accessed using this user's id
*/
UnixUserGroupInformation ugi = getUGI(job.getConf());
// Create a number of filenames in the BSPMaster's fs namespace
FileSystem fs = getFs();
fs.delete(submitJobDir, true);
submitJobDir = fs.makeQualified(submitJobDir);
submitJobDir = new Path(submitJobDir.toUri().getPath());
FsPermission bspSysPerms = new FsPermission(JOB_DIR_PERMISSION);
FileSystem.mkdirs(fs, submitJobDir, bspSysPerms);
fs.mkdirs(submitJobDir);
short replication = (short) job.getInt("bsp.submit.replication", 10);
String originalJarPath = job.getJar();
if (originalJarPath != null) { // copy jar to BSPMaster's fs
// use jar name if job is not named.
if ("".equals(job.getJobName())) {
job.setJobName(new Path(originalJarPath).getName());
}
job.setJar(submitJarFile.toString());
fs.copyFromLocalFile(new Path(originalJarPath), submitJarFile);
fs.setReplication(submitJarFile, replication);
fs.setPermission(submitJarFile, new FsPermission(JOB_FILE_PERMISSION));
} else {
LOG.warn("No job jar file set. User classes may not be found. "
+ "See BSPJob#setJar(String) or check Your jar file.");
}
// Set the user's name and working directory
job.setUser(ugi.getUserName());
if (ugi.getGroupNames().length > 0) {
job.set("group.name", ugi.getGroupNames()[0]);
}
if (job.getWorkingDirectory() == null) {
job.setWorkingDirectory(fs.getWorkingDirectory());
}