use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class HiveServer2 method startOrReconnectTezSessions.
private void startOrReconnectTezSessions() {
LOG.info("Starting/Reconnecting tez sessions..");
// TODO: add tez session reconnect after TEZ-3875
WMFullResourcePlan resourcePlan = null;
if (!StringUtils.isEmpty(wmQueue)) {
try {
resourcePlan = sessionHive.getActiveResourcePlan();
} catch (HiveException e) {
if (!HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST_SSL)) {
throw new RuntimeException(e);
} else {
// Ignore errors in SSL tests where the connection is misconfigured.
resourcePlan = null;
}
}
if (resourcePlan == null && HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_IN_TEST)) {
LOG.info("Creating a default resource plan for test");
resourcePlan = createTestResourcePlan();
}
}
initAndStartTezSessionPoolManager(resourcePlan);
initAndStartWorkloadManager(resourcePlan);
}
use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class ObjectStore method alterResourcePlan.
@Override
public WMFullResourcePlan alterResourcePlan(String name, WMNullableResourcePlan changes, boolean canActivateDisabled, boolean canDeactivate, boolean isReplace) throws AlreadyExistsException, NoSuchObjectException, InvalidOperationException, MetaException {
name = name == null ? null : normalizeIdentifier(name);
if (isReplace && name == null) {
throw new InvalidOperationException("Cannot replace without specifying the source plan");
}
boolean commited = false;
Query query = null;
// This method only returns the result when activating a resource plan.
// We could also add a boolean flag to be specified by the caller to see
// when the result might be needed.
WMFullResourcePlan result = null;
try {
openTransaction();
if (isReplace) {
result = handleAlterReplace(name, changes);
} else {
result = handleSimpleAlter(name, changes, canActivateDisabled, canDeactivate);
}
commited = commitTransaction();
return result;
} catch (Exception e) {
checkForConstraintException(e, "Resource plan name should be unique: ");
throw e;
} finally {
rollbackAndCleanup(commited, query);
}
}
use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan in project hive by apache.
the class ObjectStore method fullFromMResourcePlan.
private WMFullResourcePlan fullFromMResourcePlan(MWMResourcePlan mplan) {
if (mplan == null) {
return null;
}
WMFullResourcePlan rp = new WMFullResourcePlan();
rp.setPlan(fromMResourcePlan(mplan));
for (MWMPool mPool : mplan.getPools()) {
rp.addToPools(fromMPool(mPool, mplan.getName()));
for (MWMTrigger mTrigger : mPool.getTriggers()) {
rp.addToPoolTriggers(new WMPoolTrigger(mPool.getPath(), mTrigger.getName()));
}
}
for (MWMTrigger mTrigger : mplan.getTriggers()) {
rp.addToTriggers(fromMWMTrigger(mTrigger, mplan.getName()));
}
for (MWMMapping mMapping : mplan.getMappings()) {
rp.addToMappings(fromMMapping(mMapping, mplan.getName()));
}
return rp;
}
Aggregations