use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class TestTriggersWorkloadManager method setupTriggers.
@Override
protected void setupTriggers(final List<Trigger> triggers) throws Exception {
WorkloadManager wm = WorkloadManager.getInstance();
WMPool pool = new WMPool("rp", "llap");
pool.setAllocFraction(1.0f);
pool.setQueryParallelism(1);
WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), Lists.newArrayList(pool));
rp.getPlan().setDefaultPoolPath("llap");
for (Trigger trigger : triggers) {
rp.addToTriggers(wmTriggerFromTrigger(trigger));
rp.addToPoolTriggers(new WMPoolTrigger("llap", trigger.getName()));
}
wm.updateResourcePlanAsync(rp).get(10, TimeUnit.SECONDS);
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class MetaDataFormatUtils method formatFullRP.
public static void formatFullRP(RPFormatter rpFormatter, WMFullResourcePlan fullRp) throws HiveException {
try {
WMResourcePlan plan = fullRp.getPlan();
Integer parallelism = plan.isSetQueryParallelism() ? plan.getQueryParallelism() : null;
String defaultPool = plan.isSetDefaultPoolPath() ? plan.getDefaultPoolPath() : null;
rpFormatter.startRP(plan.getName(), "status", plan.getStatus().toString(), "parallelism", parallelism, "defaultPool", defaultPool);
rpFormatter.startPools();
PoolTreeNode root = PoolTreeNode.makePoolTree(fullRp);
root.sortChildren();
for (PoolTreeNode pool : root.children) {
pool.writePoolTreeNode(rpFormatter);
}
rpFormatter.endPools();
rpFormatter.endRP();
} catch (IOException e) {
throw new HiveException(e);
}
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class TextMetaDataFormatter method showResourcePlans.
public void showResourcePlans(DataOutputStream out, List<WMResourcePlan> resourcePlans) throws HiveException {
try {
for (WMResourcePlan plan : resourcePlans) {
out.write(plan.getName().getBytes(UTF_8));
out.write(separator);
out.write(plan.getStatus().name().getBytes(UTF_8));
out.write(separator);
if (plan.isSetQueryParallelism()) {
out.write(Integer.toString(plan.getQueryParallelism()).getBytes(UTF_8));
} else {
write(out, "null");
}
out.write(separator);
if (plan.isSetDefaultPoolPath()) {
out.write(plan.getDefaultPoolPath().getBytes(UTF_8));
} else {
write(out, "null");
}
out.write(terminator);
}
} catch (IOException e) {
throw new HiveException(e);
}
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class HiveServer2 method createTestResourcePlan.
private WMFullResourcePlan createTestResourcePlan() {
WMFullResourcePlan resourcePlan;
WMPool pool = new WMPool("testDefault", "llap");
pool.setAllocFraction(1f);
pool.setQueryParallelism(1);
resourcePlan = new WMFullResourcePlan(new WMResourcePlan("testDefault"), Lists.newArrayList(pool));
resourcePlan.getPlan().setDefaultPoolPath("testDefault");
return resourcePlan;
}
use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.
the class ObjectStore method getAllResourcePlans.
@Override
public List<WMResourcePlan> getAllResourcePlans() throws MetaException {
List<WMResourcePlan> resourcePlans = new ArrayList();
boolean commited = false;
Query query = null;
try {
openTransaction();
query = pm.newQuery(MWMResourcePlan.class);
List<MWMResourcePlan> mplans = (List<MWMResourcePlan>) query.execute();
pm.retrieveAll(mplans);
commited = commitTransaction();
if (mplans != null) {
for (MWMResourcePlan mplan : mplans) {
resourcePlans.add(fromMResourcePlan(mplan));
}
}
} finally {
rollbackAndCleanup(commited, query);
}
return resourcePlans;
}
Aggregations