Search in sources :

Example 6 with WMResourcePlan

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);
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) WMPoolTrigger(org.apache.hadoop.hive.metastore.api.WMPoolTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) WMPool(org.apache.hadoop.hive.metastore.api.WMPool) WMPoolTrigger(org.apache.hadoop.hive.metastore.api.WMPoolTrigger) WorkloadManager(org.apache.hadoop.hive.ql.exec.tez.WorkloadManager)

Example 7 with WMResourcePlan

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);
    }
}
Also used : BigInteger(java.math.BigInteger) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) IOException(java.io.IOException)

Example 8 with WMResourcePlan

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);
    }
}
Also used : HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) IOException(java.io.IOException)

Example 9 with WMResourcePlan

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;
}
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 10 with WMResourcePlan

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;
}
Also used : Query(javax.jdo.Query) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) MWMResourcePlan(org.apache.hadoop.hive.metastore.model.MWMResourcePlan) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) MStringList(org.apache.hadoop.hive.metastore.model.MStringList) ArrayList(java.util.ArrayList) List(java.util.List) MWMResourcePlan(org.apache.hadoop.hive.metastore.model.MWMResourcePlan)

Aggregations

WMResourcePlan (org.apache.hadoop.hive.metastore.api.WMResourcePlan)10 WMFullResourcePlan (org.apache.hadoop.hive.metastore.api.WMFullResourcePlan)5 IOException (java.io.IOException)3 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)3 Trigger (org.apache.hadoop.hive.ql.wm.Trigger)3 WMPool (org.apache.hadoop.hive.metastore.api.WMPool)2 WMTrigger (org.apache.hadoop.hive.metastore.api.WMTrigger)2 MWMResourcePlan (org.apache.hadoop.hive.metastore.model.MWMResourcePlan)2 ExecutionTrigger (org.apache.hadoop.hive.ql.wm.ExecutionTrigger)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Query (javax.jdo.Query)1 WMPoolTrigger (org.apache.hadoop.hive.metastore.api.WMPoolTrigger)1 MStringList (org.apache.hadoop.hive.metastore.model.MStringList)1 WorkloadManager (org.apache.hadoop.hive.ql.exec.tez.WorkloadManager)1 JsonGenerator (org.codehaus.jackson.JsonGenerator)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1