Search in sources :

Example 11 with OptionManager

use of org.apache.drill.exec.server.options.OptionManager in project drill by axbaretto.

the class StatusResources method getSystemOptionsJSONHelper.

@SuppressWarnings("resource")
private List<OptionWrapper> getSystemOptionsJSONHelper(boolean internal) {
    List<OptionWrapper> options = new LinkedList<>();
    OptionManager optionManager = work.getContext().getOptionManager();
    OptionList optionList = internal ? optionManager.getInternalOptionList() : optionManager.getPublicOptionList();
    for (OptionValue option : optionList) {
        options.add(new OptionWrapper(option.name, option.getValue(), option.accessibleScopes, option.kind, option.scope));
    }
    Collections.sort(options, new Comparator<OptionWrapper>() {

        @Override
        public int compare(OptionWrapper o1, OptionWrapper o2) {
            return o1.name.compareTo(o2.name);
        }
    });
    return options;
}
Also used : OptionValue(org.apache.drill.exec.server.options.OptionValue) LinkedList(java.util.LinkedList) OptionManager(org.apache.drill.exec.server.options.OptionManager) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager) OptionList(org.apache.drill.exec.server.options.OptionList)

Example 12 with OptionManager

use of org.apache.drill.exec.server.options.OptionManager in project drill by axbaretto.

the class QueryTestUtil method restoreScalarReplacementOption.

/**
 * Restore the original scalar replacement option returned from
 * setupScalarReplacementOption().
 *
 * <p>This also flushes the compiled code cache.
 *
 * @param drillbit the drillbit
 * @param srOption the scalar replacement option value to use
 */
public static void restoreScalarReplacementOption(final Drillbit drillbit, final String srOption) {
    @SuppressWarnings("resource") final DrillbitContext drillbitContext = drillbit.getContext();
    @SuppressWarnings("resource") final OptionManager optionManager = drillbitContext.getOptionManager();
    optionManager.setLocalOption(ClassTransformer.SCALAR_REPLACEMENT_OPTION, srOption);
    // flush the code cache
    drillbitContext.getCompiler().flushCache();
}
Also used : DrillbitContext(org.apache.drill.exec.server.DrillbitContext) OptionManager(org.apache.drill.exec.server.options.OptionManager) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager)

Example 13 with OptionManager

use of org.apache.drill.exec.server.options.OptionManager in project drill by axbaretto.

the class TestQueryMemoryAlloc method testCustomFloor.

@Test
public void testCustomFloor() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder();
    builder.systemOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
    builder.systemOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 3 * ONE_GB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.PERCENT_MEMORY_PER_QUERY_KEY, 0.05);
        optionManager.setLocalOption(ExecConstants.MAX_QUERY_MEMORY_PER_NODE_KEY, 3 * ONE_GB);
        // Out-of-box memory, use query memory per node as floor.
        long mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 8 * ONE_GB);
        assertEquals(3 * ONE_GB, mem);
        // Up to 60 GB, query memory dominates.
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 60 * ONE_GB);
        assertEquals(3 * ONE_GB, mem);
        // After 60 GB, the percent dominates
        mem = MemoryAllocationUtilities.computeQueryMemory(fixture.config(), optionManager, 100 * ONE_GB);
        assertEquals(5 * ONE_GB, mem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 14 with OptionManager

use of org.apache.drill.exec.server.options.OptionManager in project drill by axbaretto.

the class TestQueryMemoryAlloc method testOpMemory.

/**
 * Test with default options, various memory configs.
 * Since we can't change the actual CPUs on this node, use an
 * option to specify the number (rather than the usual 70% of
 * actual cores.)
 *
 * @throws Exception
 */
@Test
public void testOpMemory() throws Exception {
    OperatorFixture.Builder builder = OperatorFixture.builder();
    builder.systemOption(ExecConstants.CPU_LOAD_AVERAGE_KEY, 0.7);
    builder.systemOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 10);
    builder.systemOption(ExecConstants.MIN_MEMORY_PER_BUFFERED_OP_KEY, 40 * ONE_MB);
    try (OperatorFixture fixture = builder.build()) {
        final OptionManager optionManager = fixture.getOptionManager();
        optionManager.setLocalOption(ExecConstants.CPU_LOAD_AVERAGE_KEY, 0.7);
        optionManager.setLocalOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 10);
        optionManager.setLocalOption(ExecConstants.MIN_MEMORY_PER_BUFFERED_OP_KEY, 40 * ONE_MB);
        // Enough memory to go above configured minimum.
        long opMinMem = MemoryAllocationUtilities.computeOperatorMemory(optionManager, 4 * ONE_GB, 2);
        assertEquals(4 * ONE_GB / 10 / 2, opMinMem);
        // Too little memory per operator. Use configured minimum.
        opMinMem = MemoryAllocationUtilities.computeOperatorMemory(optionManager, ONE_GB, 100);
        assertEquals(40 * ONE_MB, opMinMem);
    }
}
Also used : OperatorFixture(org.apache.drill.test.OperatorFixture) OptionManager(org.apache.drill.exec.server.options.OptionManager) Test(org.junit.Test) DrillTest(org.apache.drill.test.DrillTest)

Example 15 with OptionManager

use of org.apache.drill.exec.server.options.OptionManager in project drill by axbaretto.

the class QueryTestUtil method restoreScalarReplacementOption.

/**
 * Restore the original scalar replacement option returned from
 * setupScalarReplacementOption().
 *
 * <p>This also flushes the compiled code cache.
 *
 * @param drillbit the drillbit
 * @param srOption the scalar replacement option value to use
 */
public static void restoreScalarReplacementOption(final Drillbit drillbit, final String srOption) {
    @SuppressWarnings("resource") final DrillbitContext drillbitContext = drillbit.getContext();
    @SuppressWarnings("resource") final OptionManager optionManager = drillbitContext.getOptionManager();
    optionManager.setLocalOption(ClassTransformer.SCALAR_REPLACEMENT_OPTION, srOption);
    // flush the code cache
    drillbitContext.getCompiler().flushCache();
}
Also used : DrillbitContext(org.apache.drill.exec.server.DrillbitContext) OptionManager(org.apache.drill.exec.server.options.OptionManager) SystemOptionManager(org.apache.drill.exec.server.options.SystemOptionManager)

Aggregations

OptionManager (org.apache.drill.exec.server.options.OptionManager)39 Test (org.junit.Test)10 DrillTest (org.apache.drill.test.DrillTest)8 OperatorFixture (org.apache.drill.test.OperatorFixture)8 DrillbitContext (org.apache.drill.exec.server.DrillbitContext)7 OptionValue (org.apache.drill.exec.server.options.OptionValue)6 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)5 SystemOptionManager (org.apache.drill.exec.server.options.SystemOptionManager)5 LinkedList (java.util.LinkedList)4 Callable (java.util.concurrent.Callable)4 ExecutionException (java.util.concurrent.ExecutionException)4 DrillConfig (org.apache.drill.common.config.DrillConfig)4 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)4 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)4 MaterializedField (org.apache.drill.exec.record.MaterializedField)4 ArrayList (java.util.ArrayList)3 RelOptPlanner (org.apache.calcite.plan.RelOptPlanner)3 RelTraitSet (org.apache.calcite.plan.RelTraitSet)3 RelNode (org.apache.calcite.rel.RelNode)3 SqlSetOption (org.apache.calcite.sql.SqlSetOption)3