use of org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService in project hive by apache.
the class FairSchedulerShim method refreshDefaultQueue.
@Override
public void refreshDefaultQueue(Configuration conf, String userName) throws IOException {
String requestedQueue = YarnConfiguration.DEFAULT_QUEUE_NAME;
final AtomicReference<AllocationConfiguration> allocConf = new AtomicReference<AllocationConfiguration>();
AllocationFileLoaderService allocsLoader = new AllocationFileLoaderService();
allocsLoader.init(conf);
allocsLoader.setReloadListener(new AllocationFileLoaderService.Listener() {
@Override
public void onReload(AllocationConfiguration allocs) {
allocConf.set(allocs);
}
});
try {
allocsLoader.reloadAllocations();
} catch (Exception ex) {
throw new IOException("Failed to load queue allocations", ex);
}
if (allocConf.get() == null) {
allocConf.set(new AllocationConfiguration(conf));
}
QueuePlacementPolicy queuePolicy = allocConf.get().getPlacementPolicy();
if (queuePolicy != null) {
requestedQueue = queuePolicy.assignAppToQueue(requestedQueue, userName);
if (StringUtils.isNotBlank(requestedQueue)) {
LOG.debug("Setting queue name to " + requestedQueue + " for user " + userName);
conf.set(MR2_JOB_QUEUE_PROPERTY, requestedQueue);
}
}
}
Aggregations