Search in sources :

Example 16 with ShuffleDescriptor

use of org.apache.flink.runtime.shuffle.ShuffleDescriptor in project flink by apache.

the class ResultPartitionDeploymentDescriptorTest method testSerializationWithNettyShuffleDescriptor.

/**
 * Tests simple de/serialization with {@link NettyShuffleDescriptor}.
 */
@Test
public void testSerializationWithNettyShuffleDescriptor() throws IOException {
    ShuffleDescriptor shuffleDescriptor = new NettyShuffleDescriptor(producerLocation, new NetworkPartitionConnectionInfo(connectionID), resultPartitionID);
    ResultPartitionDeploymentDescriptor copy = createCopyAndVerifyResultPartitionDeploymentDescriptor(shuffleDescriptor);
    assertThat(copy.getShuffleDescriptor(), instanceOf(NettyShuffleDescriptor.class));
    NettyShuffleDescriptor shuffleDescriptorCopy = (NettyShuffleDescriptor) copy.getShuffleDescriptor();
    assertThat(shuffleDescriptorCopy.getResultPartitionID(), is(resultPartitionID));
    assertThat(shuffleDescriptorCopy.isUnknown(), is(false));
    assertThat(shuffleDescriptorCopy.isLocalTo(producerLocation), is(true));
    assertThat(shuffleDescriptorCopy.getConnectionId(), is(connectionID));
}
Also used : NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) NetworkPartitionConnectionInfo(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor.NetworkPartitionConnectionInfo) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) Test(org.junit.Test)

Example 17 with ShuffleDescriptor

use of org.apache.flink.runtime.shuffle.ShuffleDescriptor in project flink by apache.

the class ShuffleDescriptorTest method getConsumedPartitionShuffleDescriptor.

private static ShuffleDescriptor getConsumedPartitionShuffleDescriptor(ResultPartitionID id, ExecutionState state, @Nullable ResultPartitionDeploymentDescriptor producedPartition, TaskDeploymentDescriptorFactory.PartitionLocationConstraint partitionLocationConstraint) {
    ShuffleDescriptor shuffleDescriptor = TaskDeploymentDescriptorFactory.getConsumedPartitionShuffleDescriptor(id, ResultPartitionType.PIPELINED, true, state, partitionLocationConstraint, producedPartition);
    assertThat(shuffleDescriptor, is(notNullValue()));
    assertThat(shuffleDescriptor.getResultPartitionID(), is(id));
    return shuffleDescriptor;
}
Also used : ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor)

Example 18 with ShuffleDescriptor

use of org.apache.flink.runtime.shuffle.ShuffleDescriptor in project flink by apache.

the class ShuffleDescriptorTest method createResultPartitionDeploymentDescriptor.

private static ResultPartitionDeploymentDescriptor createResultPartitionDeploymentDescriptor(JobID jobID, ResultPartitionID id, ResourceID location) throws ExecutionException, InterruptedException {
    ProducerDescriptor producerDescriptor = new ProducerDescriptor(location, id.getProducerId(), STUB_CONNECTION_ID.getAddress().getAddress(), STUB_CONNECTION_ID.getAddress().getPort());
    PartitionDescriptor partitionDescriptor = PartitionDescriptorBuilder.newBuilder().setPartitionId(id.getPartitionId()).build();
    ShuffleDescriptor shuffleDescriptor = ShuffleTestUtils.DEFAULT_SHUFFLE_MASTER.registerPartitionWithProducer(jobID, partitionDescriptor, producerDescriptor).get();
    return new ResultPartitionDeploymentDescriptor(partitionDescriptor, shuffleDescriptor, 1, true);
}
Also used : PartitionDescriptor(org.apache.flink.runtime.shuffle.PartitionDescriptor) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) ProducerDescriptor(org.apache.flink.runtime.shuffle.ProducerDescriptor)

Example 19 with ShuffleDescriptor

use of org.apache.flink.runtime.shuffle.ShuffleDescriptor in project flink by apache.

the class TaskDeploymentDescriptorFactoryTest method testCacheShuffleDescriptor.

private void testCacheShuffleDescriptor(TestingBlobWriter blobWriter) throws Exception {
    final JobID jobId = new JobID();
    final ExecutionJobVertex ejv = setupExecutionGraphAndGetVertex(jobId, blobWriter);
    final ExecutionVertex ev21 = ejv.getTaskVertices()[0];
    createTaskDeploymentDescriptor(ev21);
    // The ShuffleDescriptors should be cached
    final IntermediateResult consumedResult = ejv.getInputs().get(0);
    final MaybeOffloaded<ShuffleDescriptor[]> maybeOffloaded = consumedResult.getCachedShuffleDescriptors(ev21.getConsumedPartitionGroup(0));
    final ShuffleDescriptor[] cachedShuffleDescriptors = deserializeShuffleDescriptors(maybeOffloaded, jobId, blobWriter);
    // Check if the ShuffleDescriptors are cached correctly
    assertEquals(ev21.getConsumedPartitionGroup(0).size(), cachedShuffleDescriptors.length);
    int idx = 0;
    for (IntermediateResultPartitionID consumedPartitionId : ev21.getConsumedPartitionGroup(0)) {
        assertEquals(consumedPartitionId, cachedShuffleDescriptors[idx++].getResultPartitionID().getPartitionId());
    }
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) JobID(org.apache.flink.api.common.JobID) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Example 20 with ShuffleDescriptor

use of org.apache.flink.runtime.shuffle.ShuffleDescriptor in project flink by apache.

the class SingleInputGateTest method createInputGateWithLocalChannels.

private static Map<InputGateID, SingleInputGate> createInputGateWithLocalChannels(NettyShuffleEnvironment network, int numberOfGates, @SuppressWarnings("SameParameterValue") int numberOfLocalChannels) throws IOException {
    ShuffleDescriptor[] channelDescs = new NettyShuffleDescriptor[numberOfLocalChannels];
    for (int i = 0; i < numberOfLocalChannels; i++) {
        channelDescs[i] = createRemoteWithIdAndLocation(new IntermediateResultPartitionID(), ResourceID.generate());
    }
    InputGateDeploymentDescriptor[] gateDescs = new InputGateDeploymentDescriptor[numberOfGates];
    IntermediateDataSetID[] ids = new IntermediateDataSetID[numberOfGates];
    for (int i = 0; i < numberOfGates; i++) {
        ids[i] = new IntermediateDataSetID();
        gateDescs[i] = new InputGateDeploymentDescriptor(ids[i], ResultPartitionType.PIPELINED, 0, channelDescs);
    }
    ExecutionAttemptID consumerID = new ExecutionAttemptID();
    SingleInputGate[] gates = network.createInputGates(network.createShuffleIOOwnerContext("", consumerID, new UnregisteredMetricsGroup()), SingleInputGateBuilder.NO_OP_PRODUCER_CHECKER, asList(gateDescs)).toArray(new SingleInputGate[] {});
    Map<InputGateID, SingleInputGate> inputGatesById = new HashMap<>();
    for (int i = 0; i < numberOfGates; i++) {
        inputGatesById.put(new InputGateID(ids[i], consumerID), gates[i]);
    }
    return inputGatesById;
}
Also used : NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) UnregisteredMetricsGroup(org.apache.flink.metrics.groups.UnregisteredMetricsGroup) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) HashMap(java.util.HashMap) InputGateDeploymentDescriptor(org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) IntermediateDataSetID(org.apache.flink.runtime.jobgraph.IntermediateDataSetID) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Aggregations

ShuffleDescriptor (org.apache.flink.runtime.shuffle.ShuffleDescriptor)21 NettyShuffleDescriptor (org.apache.flink.runtime.shuffle.NettyShuffleDescriptor)9 UnknownShuffleDescriptor (org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor)9 JobID (org.apache.flink.api.common.JobID)7 Test (org.junit.Test)7 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)5 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)5 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)5 InputGateDeploymentDescriptor (org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor)4 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)3 DefaultScheduler (org.apache.flink.runtime.scheduler.DefaultScheduler)3 HashMap (java.util.HashMap)2 PermanentBlobKey (org.apache.flink.runtime.blob.PermanentBlobKey)2 ResultPartitionDeploymentDescriptor (org.apache.flink.runtime.deployment.ResultPartitionDeploymentDescriptor)2 TaskDeploymentDescriptor (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor)2 MaybeOffloaded (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor.MaybeOffloaded)2 Offloaded (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor.Offloaded)2 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)2 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)2 ArrayList (java.util.ArrayList)1