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;
}
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();
}
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);
}
}
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);
}
}
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();
}
Aggregations