Search in sources :

Example 31 with WMFullResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMFullResourcePlan 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;
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) WMPool(org.apache.hadoop.hive.metastore.api.WMPool)

Example 32 with WMFullResourcePlan

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;
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) MWMPool(org.apache.hadoop.hive.metastore.model.MWMPool) MWMTrigger(org.apache.hadoop.hive.metastore.model.MWMTrigger) WMPoolTrigger(org.apache.hadoop.hive.metastore.api.WMPoolTrigger) MWMMapping(org.apache.hadoop.hive.metastore.model.MWMMapping)

Example 33 with WMFullResourcePlan

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, String ns, 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, ns, changes);
        } else {
            result = handleSimpleAlter(name, ns, changes, canActivateDisabled, canDeactivate);
        }
        commited = commitTransaction();
        return result;
    } catch (Exception e) {
        checkForConstraintException(e, "Resource plan name should be unique: ");
        throw e;
    } finally {
        rollbackAndCleanup(commited, query);
    }
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) ScheduledQuery(org.apache.hadoop.hive.metastore.api.ScheduledQuery) Query(javax.jdo.Query) MScheduledQuery(org.apache.hadoop.hive.metastore.model.MScheduledQuery) InvalidOperationException(org.apache.hadoop.hive.metastore.api.InvalidOperationException) AlreadyExistsException(org.apache.hadoop.hive.metastore.api.AlreadyExistsException) InvalidInputException(org.apache.hadoop.hive.metastore.api.InvalidInputException) InvalidOperationException(org.apache.hadoop.hive.metastore.api.InvalidOperationException) SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) IOException(java.io.IOException) NoSuchObjectException(org.apache.hadoop.hive.metastore.api.NoSuchObjectException) MetaException(org.apache.hadoop.hive.metastore.api.MetaException) InvalidPartitionException(org.apache.hadoop.hive.metastore.api.InvalidPartitionException) UnknownPartitionException(org.apache.hadoop.hive.metastore.api.UnknownPartitionException) InvalidObjectException(org.apache.hadoop.hive.metastore.api.InvalidObjectException) JDOException(javax.jdo.JDOException) MissingTableException(org.datanucleus.store.rdbms.exceptions.MissingTableException) SQLException(java.sql.SQLException) UnknownDBException(org.apache.hadoop.hive.metastore.api.UnknownDBException) TException(org.apache.thrift.TException) JDODataStoreException(javax.jdo.JDODataStoreException) JDOObjectNotFoundException(javax.jdo.JDOObjectNotFoundException) UnknownTableException(org.apache.hadoop.hive.metastore.api.UnknownTableException)

Aggregations

WMFullResourcePlan (org.apache.hadoop.hive.metastore.api.WMFullResourcePlan)33 Test (org.junit.Test)16 HiveConf (org.apache.hadoop.hive.conf.HiveConf)14 CountDownLatch (java.util.concurrent.CountDownLatch)6 AtomicReference (java.util.concurrent.atomic.AtomicReference)6 WMResourcePlan (org.apache.hadoop.hive.metastore.api.WMResourcePlan)5 Trigger (org.apache.hadoop.hive.ql.wm.Trigger)5 WMNullableResourcePlan (org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan)4 WMPool (org.apache.hadoop.hive.metastore.api.WMPool)4 WMPoolTrigger (org.apache.hadoop.hive.metastore.api.WMPoolTrigger)4 ExecutionTrigger (org.apache.hadoop.hive.ql.wm.ExecutionTrigger)4 ArgumentMatchers.anyBoolean (org.mockito.ArgumentMatchers.anyBoolean)4 Query (javax.jdo.Query)3 WMTrigger (org.apache.hadoop.hive.metastore.api.WMTrigger)3 WorkloadManager (org.apache.hadoop.hive.ql.exec.tez.WorkloadManager)3 SessionTriggerProvider (org.apache.hadoop.hive.ql.wm.SessionTriggerProvider)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 ExecutionException (java.util.concurrent.ExecutionException)2