Search in sources :

Example 1 with IClusterCapacity

use of org.apache.hyracks.api.job.resource.IClusterCapacity in project asterixdb by apache.

the class JobCapacityController method release.

@Override
public void release(JobSpecification job) {
    IClusterCapacity requiredCapacity = job.getRequiredClusterCapacity();
    long reqAggregatedMemoryByteSize = requiredCapacity.getAggregatedMemoryByteSize();
    int reqAggregatedNumCores = requiredCapacity.getAggregatedCores();
    IClusterCapacity currentCapacity = resourceManager.getCurrentCapacity();
    long aggregatedMemoryByteSize = currentCapacity.getAggregatedMemoryByteSize();
    int aggregatedNumCores = currentCapacity.getAggregatedCores();
    currentCapacity.setAggregatedMemoryByteSize(aggregatedMemoryByteSize + reqAggregatedMemoryByteSize);
    currentCapacity.setAggregatedCores(aggregatedNumCores + reqAggregatedNumCores);
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity)

Example 2 with IClusterCapacity

use of org.apache.hyracks.api.job.resource.IClusterCapacity in project asterixdb by apache.

the class JobCapacityControllerTest method makeJobWithRequiredCapacity.

private JobSpecification makeJobWithRequiredCapacity(long memorySize, int cores) {
    // Generates cluster capacity.
    IClusterCapacity clusterCapacity = makeComputationCapacity(memorySize, cores);
    // Generates a job.
    JobSpecification job = mock(JobSpecification.class);
    when(job.getRequiredClusterCapacity()).thenReturn(clusterCapacity);
    return job;
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) JobSpecification(org.apache.hyracks.api.job.JobSpecification)

Example 3 with IClusterCapacity

use of org.apache.hyracks.api.job.resource.IClusterCapacity in project asterixdb by apache.

the class JobCapacityControllerTest method makeComputationCapacity.

private IClusterCapacity makeComputationCapacity(long memorySize, int cores) {
    IClusterCapacity clusterCapacity = new ClusterCapacity();
    clusterCapacity.setAggregatedMemoryByteSize(memorySize);
    clusterCapacity.setAggregatedCores(cores);
    return clusterCapacity;
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) ClusterCapacity(org.apache.hyracks.api.job.resource.ClusterCapacity) IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity)

Example 4 with IClusterCapacity

use of org.apache.hyracks.api.job.resource.IClusterCapacity in project asterixdb by apache.

the class RequiredCapacityVisitorTest method testParallelGroupBy.

@Test
public void testParallelGroupBy() throws AlgebricksException {
    IClusterCapacity clusterCapacity = new ClusterCapacity();
    RequiredCapacityVisitor visitor = makeComputationCapacityVisitor(PARALLELISM, clusterCapacity);
    // Constructs a parallel group-by query plan.
    GroupByOperator globalGby = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    ExchangeOperator exchange = new ExchangeOperator();
    exchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
    GroupByOperator localGby = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.LOCAL);
    globalGby.getInputs().add(new MutableObject<>(exchange));
    exchange.getInputs().add(new MutableObject<>(localGby));
    // Verifies the calculated cluster capacity requirement for the test quer plan.
    globalGby.accept(visitor, null);
    Assert.assertTrue(clusterCapacity.getAggregatedCores() == PARALLELISM);
    Assert.assertTrue(clusterCapacity.getAggregatedMemoryByteSize() == 2 * MEMORY_BUDGET * PARALLELISM + 2 * FRAME_SIZE * PARALLELISM * PARALLELISM);
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) GroupByOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator) ClusterCapacity(org.apache.hyracks.api.job.resource.ClusterCapacity) IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) HashPartitionExchangePOperator(org.apache.hyracks.algebricks.core.algebra.operators.physical.HashPartitionExchangePOperator) ExchangeOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator) Test(org.junit.Test)

Example 5 with IClusterCapacity

use of org.apache.hyracks.api.job.resource.IClusterCapacity in project asterixdb by apache.

the class RequiredCapacityVisitorTest method testParallelJoin.

@Test
public void testParallelJoin() throws AlgebricksException {
    IClusterCapacity clusterCapacity = new ClusterCapacity();
    RequiredCapacityVisitor visitor = makeComputationCapacityVisitor(PARALLELISM, clusterCapacity);
    // Constructs a join query plan.
    InnerJoinOperator join = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    // Left child plan of the join.
    ExchangeOperator leftChildExchange = new ExchangeOperator();
    leftChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    leftChildExchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
    InnerJoinOperator leftChild = makeJoinOperator(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    join.getInputs().add(new MutableObject<>(leftChildExchange));
    leftChildExchange.getInputs().add(new MutableObject<>(leftChild));
    EmptyTupleSourceOperator ets = new EmptyTupleSourceOperator();
    ets.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    leftChild.getInputs().add(new MutableObject<>(ets));
    leftChild.getInputs().add(new MutableObject<>(ets));
    // Right child plan of the join.
    ExchangeOperator rightChildExchange = new ExchangeOperator();
    rightChildExchange.setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
    rightChildExchange.setPhysicalOperator(new HashPartitionExchangePOperator(Collections.emptyList(), null));
    GroupByOperator rightChild = makeGroupByOperator(AbstractLogicalOperator.ExecutionMode.LOCAL);
    join.getInputs().add(new MutableObject<>(rightChildExchange));
    rightChildExchange.getInputs().add(new MutableObject<>(rightChild));
    rightChild.getInputs().add(new MutableObject<>(ets));
    // Verifies the calculated cluster capacity requirement for the test quer plan.
    join.accept(visitor, null);
    Assert.assertTrue(clusterCapacity.getAggregatedCores() == PARALLELISM);
    Assert.assertTrue(clusterCapacity.getAggregatedMemoryByteSize() == 3 * MEMORY_BUDGET * PARALLELISM + 2 * 2L * PARALLELISM * PARALLELISM * FRAME_SIZE + 3 * FRAME_SIZE * PARALLELISM);
}
Also used : IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) GroupByOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator) ClusterCapacity(org.apache.hyracks.api.job.resource.ClusterCapacity) IClusterCapacity(org.apache.hyracks.api.job.resource.IClusterCapacity) HashPartitionExchangePOperator(org.apache.hyracks.algebricks.core.algebra.operators.physical.HashPartitionExchangePOperator) ExchangeOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator) InnerJoinOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator) EmptyTupleSourceOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.EmptyTupleSourceOperator) Test(org.junit.Test)

Aggregations

IClusterCapacity (org.apache.hyracks.api.job.resource.IClusterCapacity)10 ClusterCapacity (org.apache.hyracks.api.job.resource.ClusterCapacity)7 ExchangeOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator)4 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)4 Test (org.junit.Test)4 EmptyTupleSourceOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.EmptyTupleSourceOperator)2 InnerJoinOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator)2 HashPartitionExchangePOperator (org.apache.hyracks.algebricks.core.algebra.operators.physical.HashPartitionExchangePOperator)2 OneToOneExchangePOperator (org.apache.hyracks.algebricks.core.algebra.operators.physical.OneToOneExchangePOperator)2 RequiredCapacityVisitor (org.apache.asterix.app.resource.RequiredCapacityVisitor)1 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1 JobSpecification (org.apache.hyracks.api.job.JobSpecification)1 IReadOnlyClusterCapacity (org.apache.hyracks.api.job.resource.IReadOnlyClusterCapacity)1