Search in sources :

Example 1 with WMResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.

the class ObjectStore method fromMResourcePlan.

private WMResourcePlan fromMResourcePlan(MWMResourcePlan mplan) {
    if (mplan == null) {
        return null;
    }
    WMResourcePlan rp = new WMResourcePlan();
    rp.setName(mplan.getName());
    rp.setStatus(WMResourcePlanStatus.valueOf(mplan.getStatus().name()));
    if (mplan.getQueryParallelism() != null) {
        rp.setQueryParallelism(mplan.getQueryParallelism());
    }
    if (mplan.getDefaultPool() != null) {
        rp.setDefaultPoolPath(mplan.getDefaultPool().getPath());
    }
    return rp;
}
Also used : WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) MWMResourcePlan(org.apache.hadoop.hive.metastore.model.MWMResourcePlan)

Example 2 with WMResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.

the class JsonMetaDataFormatter method showResourcePlans.

@Override
public void showResourcePlans(DataOutputStream out, List<WMResourcePlan> resourcePlans) throws HiveException {
    JsonGenerator generator = null;
    try {
        generator = new ObjectMapper().getJsonFactory().createJsonGenerator(out);
        generator.writeStartArray();
        for (WMResourcePlan plan : resourcePlans) {
            generator.writeStartObject();
            generator.writeStringField("name", plan.getName());
            generator.writeStringField("status", plan.getStatus().name());
            if (plan.isSetQueryParallelism()) {
                generator.writeNumberField("queryParallelism", plan.getQueryParallelism());
            }
            if (plan.isSetDefaultPoolPath()) {
                generator.writeStringField("defaultPoolPath", plan.getDefaultPoolPath());
            }
            generator.writeEndObject();
        }
        generator.writeEndArray();
        generator.close();
    } catch (IOException e) {
        throw new HiveException(e);
    } finally {
        if (generator != null) {
            IOUtils.closeQuietly(generator);
        }
    }
}
Also used : HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) JsonGenerator(org.codehaus.jackson.JsonGenerator) IOException(java.io.IOException) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 3 with WMResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.

the class TestJsonRPFormatter method createRP.

private WMFullResourcePlan createRP(String name, Integer parallelism, String defaultPoolPath) {
    WMResourcePlan rp = new WMResourcePlan(name);
    rp.setStatus(WMResourcePlanStatus.ACTIVE);
    if (parallelism != null) {
        rp.setQueryParallelism(parallelism);
    }
    if (defaultPoolPath != null) {
        rp.setDefaultPoolPath(defaultPoolPath);
    }
    WMFullResourcePlan fullRp = new WMFullResourcePlan(rp, new ArrayList<>());
    return fullRp;
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan)

Example 4 with WMResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.

the class TestTriggersNoTezSessionPool method setupTriggers.

@Override
void setupTriggers(final List<Trigger> triggers) throws Exception {
    WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), null);
    for (Trigger trigger : triggers) {
        WMTrigger wmTrigger = wmTriggerFromTrigger(trigger);
        wmTrigger.setIsInUnmanaged(true);
        rp.addToTriggers(wmTrigger);
    }
    TezSessionPoolManager.getInstance().updateTriggers(rp);
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger)

Example 5 with WMResourcePlan

use of org.apache.hadoop.hive.metastore.api.WMResourcePlan in project hive by apache.

the class TestTriggersTezSessionPoolManager method setupTriggers.

@Override
protected void setupTriggers(final List<Trigger> triggers) throws Exception {
    WMFullResourcePlan rp = new WMFullResourcePlan(new WMResourcePlan("rp"), null);
    for (Trigger trigger : triggers) {
        WMTrigger wmTrigger = wmTriggerFromTrigger(trigger);
        wmTrigger.setIsInUnmanaged(true);
        rp.addToTriggers(wmTrigger);
    }
    TezSessionPoolManager.getInstance().updateTriggers(rp);
}
Also used : WMFullResourcePlan(org.apache.hadoop.hive.metastore.api.WMFullResourcePlan) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger) ExecutionTrigger(org.apache.hadoop.hive.ql.wm.ExecutionTrigger) Trigger(org.apache.hadoop.hive.ql.wm.Trigger) WMResourcePlan(org.apache.hadoop.hive.metastore.api.WMResourcePlan) WMTrigger(org.apache.hadoop.hive.metastore.api.WMTrigger)

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