* @return
*/
protected SliderClient getSliderClient() {
Configuration sliderClientConfiguration = getSliderClientConfiguration();
if (sliderClientConfiguration != null) {
SliderClient client = new SliderClient() {
@Override
public String getUsername() throws IOException {
return "yarn";
}
@Override
protected void serviceInit(Configuration conf) throws Exception {
super.serviceInit(conf);
// Override the default FS client to set the super user.
FileSystem fs = FileSystem.get(FileSystem.getDefaultUri(getConfig()),
getConfig(), "yarn");
SliderFileSystem fileSystem = new SliderFileSystem(fs, getConfig());
Field fsField = SliderClient.class
.getDeclaredField("sliderFileSystem");
fsField.setAccessible(true);
fsField.set(this, fileSystem);
}
};
try {
sliderClientConfiguration = client.bindArgs(sliderClientConfiguration,
new String[]{"usage"});
} catch (Exception e) {
logger.warn("Unable to set SliderClient configs", e);
throw new RuntimeException(e.getMessage(), e);
}
client.init(sliderClientConfiguration);
client.start();
return client;
}
return null;
}