Search in sources :

Example 1 with UnknownShuffleDescriptor

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

the class ShuffleDescriptorTest method testMixedLocalRemoteUnknownDeployment.

/**
 * Tests the deployment descriptors for local, remote, and unknown partition locations (with
 * lazy deployment allowed and all execution states for the producers).
 */
@Test
public void testMixedLocalRemoteUnknownDeployment() throws Exception {
    ResourceID consumerResourceID = ResourceID.generate();
    JobID jobID = new JobID();
    // states.
    for (ExecutionState state : ExecutionState.values()) {
        ResultPartitionID localPartitionId = new ResultPartitionID();
        ResultPartitionDeploymentDescriptor localPartition = createResultPartitionDeploymentDescriptor(jobID, localPartitionId, consumerResourceID);
        ResultPartitionID remotePartitionId = new ResultPartitionID();
        ResultPartitionDeploymentDescriptor remotePartition = createResultPartitionDeploymentDescriptor(jobID, remotePartitionId, ResourceID.generate());
        ResultPartitionID unknownPartitionId = new ResultPartitionID();
        ShuffleDescriptor localShuffleDescriptor = getConsumedPartitionShuffleDescriptor(localPartitionId, state, localPartition, TaskDeploymentDescriptorFactory.PartitionLocationConstraint.CAN_BE_UNKNOWN);
        ShuffleDescriptor remoteShuffleDescriptor = getConsumedPartitionShuffleDescriptor(remotePartitionId, state, remotePartition, TaskDeploymentDescriptorFactory.PartitionLocationConstraint.CAN_BE_UNKNOWN);
        ShuffleDescriptor unknownShuffleDescriptor = getConsumedPartitionShuffleDescriptor(unknownPartitionId, state, null, TaskDeploymentDescriptorFactory.PartitionLocationConstraint.CAN_BE_UNKNOWN);
        // These states are allowed
        if (state == ExecutionState.RUNNING || state == ExecutionState.INITIALIZING || state == ExecutionState.FINISHED || state == ExecutionState.SCHEDULED || state == ExecutionState.DEPLOYING) {
            NettyShuffleDescriptor nettyShuffleDescriptor;
            // Create local or remote channels
            verifyShuffleDescriptor(localShuffleDescriptor, NettyShuffleDescriptor.class, false, localPartitionId);
            nettyShuffleDescriptor = (NettyShuffleDescriptor) localShuffleDescriptor;
            assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(true));
            verifyShuffleDescriptor(remoteShuffleDescriptor, NettyShuffleDescriptor.class, false, remotePartitionId);
            nettyShuffleDescriptor = (NettyShuffleDescriptor) remoteShuffleDescriptor;
            assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(false));
            assertThat(nettyShuffleDescriptor.getConnectionId(), is(STUB_CONNECTION_ID));
        } else {
            // Unknown (lazy deployment allowed)
            verifyShuffleDescriptor(localShuffleDescriptor, UnknownShuffleDescriptor.class, true, localPartitionId);
            verifyShuffleDescriptor(remoteShuffleDescriptor, UnknownShuffleDescriptor.class, true, remotePartitionId);
        }
        verifyShuffleDescriptor(unknownShuffleDescriptor, UnknownShuffleDescriptor.class, true, unknownPartitionId);
    }
}
Also used : ExecutionState(org.apache.flink.runtime.execution.ExecutionState) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) ResourceID(org.apache.flink.runtime.clusterframework.types.ResourceID) ResultPartitionID(org.apache.flink.runtime.io.network.partition.ResultPartitionID) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 2 with UnknownShuffleDescriptor

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

the class ResultPartitionDeploymentDescriptorTest method testSerializationOfUnknownShuffleDescriptor.

/**
 * Tests simple de/serialization with {@link UnknownShuffleDescriptor}.
 */
@Test
public void testSerializationOfUnknownShuffleDescriptor() throws IOException {
    ShuffleDescriptor shuffleDescriptor = new UnknownShuffleDescriptor(resultPartitionID);
    ShuffleDescriptor shuffleDescriptorCopy = CommonTestUtils.createCopySerializable(shuffleDescriptor);
    assertThat(shuffleDescriptorCopy, instanceOf(UnknownShuffleDescriptor.class));
    assertThat(shuffleDescriptorCopy.getResultPartitionID(), is(resultPartitionID));
    assertThat(shuffleDescriptorCopy.isUnknown(), is(true));
}
Also used : ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) Test(org.junit.Test)

Example 3 with UnknownShuffleDescriptor

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

the class SingleInputGateTest method createSingleInputGate.

static SingleInputGate createSingleInputGate(IntermediateResultPartitionID[] partitionIds, ResultPartitionType resultPartitionType, SubpartitionIndexRange subpartitionIndexRange, NettyShuffleEnvironment netEnv, ResourceID localLocation, ConnectionManager connectionManager, ResultPartitionManager resultPartitionManager) throws IOException {
    ShuffleDescriptor[] channelDescs = new ShuffleDescriptor[] { // Local
    createRemoteWithIdAndLocation(partitionIds[0], localLocation), // Remote
    createRemoteWithIdAndLocation(partitionIds[1], ResourceID.generate()), // Unknown
    new UnknownShuffleDescriptor(new ResultPartitionID(partitionIds[2], new ExecutionAttemptID())) };
    InputGateDeploymentDescriptor gateDesc = new InputGateDeploymentDescriptor(new IntermediateDataSetID(), resultPartitionType, subpartitionIndexRange, new TaskDeploymentDescriptor.NonOffloaded<>(CompressedSerializedValue.fromObject(channelDescs)));
    final TaskMetricGroup taskMetricGroup = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup();
    return new SingleInputGateFactory(localLocation, netEnv.getConfiguration(), connectionManager != null ? connectionManager : netEnv.getConnectionManager(), resultPartitionManager != null ? resultPartitionManager : netEnv.getResultPartitionManager(), new TaskEventDispatcher(), netEnv.getNetworkBufferPool()).create(netEnv.createShuffleIOOwnerContext("TestTask", taskMetricGroup.executionId(), taskMetricGroup), 0, gateDesc, SingleInputGateBuilder.NO_OP_PRODUCER_CHECKER);
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) TaskMetricGroup(org.apache.flink.runtime.metrics.groups.TaskMetricGroup) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor) NettyShuffleDescriptor(org.apache.flink.runtime.shuffle.NettyShuffleDescriptor) ShuffleDescriptor(org.apache.flink.runtime.shuffle.ShuffleDescriptor) ResultPartitionID(org.apache.flink.runtime.io.network.partition.ResultPartitionID) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) IntermediateDataSetID(org.apache.flink.runtime.jobgraph.IntermediateDataSetID) TaskDeploymentDescriptor(org.apache.flink.runtime.deployment.TaskDeploymentDescriptor) TaskEventDispatcher(org.apache.flink.runtime.io.network.TaskEventDispatcher) InputGateDeploymentDescriptor(org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor) UnknownShuffleDescriptor(org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor)

Aggregations

NettyShuffleDescriptor (org.apache.flink.runtime.shuffle.NettyShuffleDescriptor)3 ShuffleDescriptor (org.apache.flink.runtime.shuffle.ShuffleDescriptor)3 UnknownShuffleDescriptor (org.apache.flink.runtime.shuffle.UnknownShuffleDescriptor)3 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)2 Test (org.junit.Test)2 JobID (org.apache.flink.api.common.JobID)1 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)1 InputGateDeploymentDescriptor (org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor)1 TaskDeploymentDescriptor (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor)1 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)1 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)1 TaskEventDispatcher (org.apache.flink.runtime.io.network.TaskEventDispatcher)1 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)1 IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)1 TaskMetricGroup (org.apache.flink.runtime.metrics.groups.TaskMetricGroup)1