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