Search in sources :

Example 1 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class ResultPartitionManager method releasePartitionsProducedBy.

public void releasePartitionsProducedBy(ExecutionAttemptID executionId, Throwable cause) {
    synchronized (registeredPartitions) {
        final Map<IntermediateResultPartitionID, ResultPartition> partitions = registeredPartitions.row(executionId);
        for (ResultPartition partition : partitions.values()) {
            partition.release(cause);
        }
        for (IntermediateResultPartitionID partitionId : ImmutableList.copyOf(partitions.keySet())) {
            registeredPartitions.remove(executionId, partitionId);
        }
        LOG.debug("Released all partitions produced by {}.", executionId);
    }
}
Also used : IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Example 2 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class SingleInputGate method updateInputChannel.

public void updateInputChannel(InputChannelDeploymentDescriptor icdd) throws IOException, InterruptedException {
    synchronized (requestLock) {
        if (isReleased) {
            // There was a race with a task failure/cancel
            return;
        }
        final IntermediateResultPartitionID partitionId = icdd.getConsumedPartitionId().getPartitionId();
        InputChannel current = inputChannels.get(partitionId);
        if (current.getClass() == UnknownInputChannel.class) {
            UnknownInputChannel unknownChannel = (UnknownInputChannel) current;
            InputChannel newChannel;
            ResultPartitionLocation partitionLocation = icdd.getConsumedPartitionLocation();
            if (partitionLocation.isLocal()) {
                newChannel = unknownChannel.toLocalInputChannel();
            } else if (partitionLocation.isRemote()) {
                newChannel = unknownChannel.toRemoteInputChannel(partitionLocation.getConnectionId());
            } else {
                throw new IllegalStateException("Tried to update unknown channel with unknown channel.");
            }
            LOG.debug("Updated unknown input channel to {}.", newChannel);
            inputChannels.put(partitionId, newChannel);
            if (requestedPartitionsFlag) {
                newChannel.requestSubpartition(consumedSubpartitionIndex);
            }
            for (TaskEvent event : pendingEvents) {
                newChannel.sendTaskEvent(event);
            }
            if (--numberOfUninitializedChannels == 0) {
                pendingEvents.clear();
            }
        }
    }
}
Also used : ResultPartitionLocation(org.apache.flink.runtime.deployment.ResultPartitionLocation) TaskEvent(org.apache.flink.runtime.event.TaskEvent) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Example 3 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class ExecutionGraphSignalsTest method testFailingScheduleOrUpdateConsumers.

/**
	 * Tests that a failing scheduleOrUpdateConsumers call with a non-existing execution attempt
	 * id, will not fail the execution graph.
	 */
@Test
public void testFailingScheduleOrUpdateConsumers() throws IllegalAccessException {
    IntermediateResultPartitionID intermediateResultPartitionId = new IntermediateResultPartitionID();
    // The execution attempt id does not exist and thus the scheduleOrUpdateConsumers call
    // should fail
    ExecutionAttemptID producerId = new ExecutionAttemptID();
    ResultPartitionID resultPartitionId = new ResultPartitionID(intermediateResultPartitionId, producerId);
    f.set(eg, JobStatus.RUNNING);
    assertEquals(JobStatus.RUNNING, eg.getState());
    try {
        eg.scheduleOrUpdateConsumers(resultPartitionId);
        fail("Expected ExecutionGraphException.");
    } catch (ExecutionGraphException e) {
    // we've expected this exception to occur
    }
    assertEquals(JobStatus.RUNNING, eg.getState());
}
Also used : IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) ResultPartitionID(org.apache.flink.runtime.io.network.partition.ResultPartitionID) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class ResultPartitionDeploymentDescriptorTest method testSerialization.

/**
	 * Tests simple de/serialization.
	 */
@Test
public void testSerialization() throws Exception {
    // Expected values
    IntermediateDataSetID resultId = new IntermediateDataSetID();
    IntermediateResultPartitionID partitionId = new IntermediateResultPartitionID();
    ResultPartitionType partitionType = ResultPartitionType.PIPELINED;
    int numberOfSubpartitions = 24;
    ResultPartitionDeploymentDescriptor orig = new ResultPartitionDeploymentDescriptor(resultId, partitionId, partitionType, numberOfSubpartitions, numberOfSubpartitions, true);
    ResultPartitionDeploymentDescriptor copy = CommonTestUtils.createCopySerializable(orig);
    assertEquals(resultId, copy.getResultId());
    assertEquals(partitionId, copy.getPartitionId());
    assertEquals(partitionType, copy.getPartitionType());
    assertEquals(numberOfSubpartitions, copy.getNumberOfSubpartitions());
    assertTrue(copy.sendScheduleOrUpdateConsumersMessage());
}
Also used : ResultPartitionType(org.apache.flink.runtime.io.network.partition.ResultPartitionType) IntermediateDataSetID(org.apache.flink.runtime.jobgraph.IntermediateDataSetID) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID) Test(org.junit.Test)

Example 5 with IntermediateResultPartitionID

use of org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID in project flink by apache.

the class InputChannelDeploymentDescriptorTest method mockPartition.

private static IntermediateResultPartition mockPartition(ExecutionVertex producer) {
    IntermediateResultPartition partition = mock(IntermediateResultPartition.class);
    when(partition.isConsumable()).thenReturn(true);
    IntermediateResult result = mock(IntermediateResult.class);
    when(result.getConnectionIndex()).thenReturn(0);
    when(partition.getIntermediateResult()).thenReturn(result);
    when(partition.getPartitionId()).thenReturn(new IntermediateResultPartitionID());
    when(partition.getProducer()).thenReturn(producer);
    return partition;
}
Also used : IntermediateResult(org.apache.flink.runtime.executiongraph.IntermediateResult) IntermediateResultPartition(org.apache.flink.runtime.executiongraph.IntermediateResultPartition) IntermediateResultPartitionID(org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)

Aggregations

IntermediateResultPartitionID (org.apache.flink.runtime.jobgraph.IntermediateResultPartitionID)66 Test (org.junit.Test)41 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)18 ConsumedPartitionGroup (org.apache.flink.runtime.scheduler.strategy.ConsumedPartitionGroup)14 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)13 JobID (org.apache.flink.api.common.JobID)12 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)12 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)11 ArrayList (java.util.ArrayList)10 TaskDeploymentDescriptor (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor)10 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)10 InputGateDeploymentDescriptor (org.apache.flink.runtime.deployment.InputGateDeploymentDescriptor)9 ResultPartitionDeploymentDescriptor (org.apache.flink.runtime.deployment.ResultPartitionDeploymentDescriptor)9 CompletableFuture (java.util.concurrent.CompletableFuture)8 Configuration (org.apache.flink.configuration.Configuration)8 ShuffleDescriptor (org.apache.flink.runtime.shuffle.ShuffleDescriptor)8 IOException (java.io.IOException)7 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)7 Collection (java.util.Collection)6 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)6