use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink by apache.
the class FailureHandlingResultSnapshot method create.
/**
* Creates a {@code FailureHandlingResultSnapshot} based on the passed {@link
* FailureHandlingResult} and {@link ExecutionVertex ExecutionVertices}.
*
* @param failureHandlingResult The {@code FailureHandlingResult} that is used for extracting
* the failure information.
* @param latestExecutionLookup The look-up function for retrieving the latest {@link Execution}
* instance for a given {@link ExecutionVertexID}.
* @return The {@code FailureHandlingResultSnapshot}.
*/
public static FailureHandlingResultSnapshot create(FailureHandlingResult failureHandlingResult, Function<ExecutionVertexID, Execution> latestExecutionLookup) {
final Execution rootCauseExecution = failureHandlingResult.getExecutionVertexIdOfFailedTask().map(latestExecutionLookup).orElse(null);
Preconditions.checkArgument(rootCauseExecution == null || rootCauseExecution.getFailureInfo().isPresent(), String.format("The execution %s didn't provide a failure info even though the corresponding ExecutionVertex %s is marked as having handled the root cause of this failure.", // added to make the compiler happy
rootCauseExecution != null ? rootCauseExecution.getAttemptId() : "(null)", failureHandlingResult.getExecutionVertexIdOfFailedTask().map(Objects::toString).orElse("(null)")));
final ExecutionVertexID rootCauseExecutionVertexId = failureHandlingResult.getExecutionVertexIdOfFailedTask().orElse(null);
final Set<Execution> concurrentlyFailedExecutions = failureHandlingResult.getVerticesToRestart().stream().filter(executionVertexId -> !executionVertexId.equals(rootCauseExecutionVertexId)).map(latestExecutionLookup).filter(execution -> execution.getFailureInfo().isPresent()).collect(Collectors.toSet());
return new FailureHandlingResultSnapshot(rootCauseExecution, ErrorInfo.handleMissingThrowable(failureHandlingResult.getError()), failureHandlingResult.getTimestamp(), concurrentlyFailedExecutions);
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink by apache.
the class ExecutionGraphToInputsLocationsRetrieverAdapter method getConsumedResultPartitionsProducers.
@Override
public Collection<Collection<ExecutionVertexID>> getConsumedResultPartitionsProducers(ExecutionVertexID executionVertexId) {
ExecutionVertex ev = getExecutionVertex(executionVertexId);
InternalExecutionGraphAccessor executionGraphAccessor = ev.getExecutionGraphAccessor();
List<Collection<ExecutionVertexID>> resultPartitionProducers = new ArrayList<>(ev.getNumberOfInputs());
for (ConsumedPartitionGroup consumedPartitions : ev.getAllConsumedPartitionGroups()) {
List<ExecutionVertexID> producers = new ArrayList<>(consumedPartitions.size());
for (IntermediateResultPartitionID consumedPartitionId : consumedPartitions) {
ExecutionVertex producer = executionGraphAccessor.getResultPartitionOrThrow(consumedPartitionId).getProducer();
producers.add(producer.getID());
}
resultPartitionProducers.add(producers);
}
return resultPartitionProducers;
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink by apache.
the class SlotSharingSlotAllocatorTest method testReserveAvailableResources.
@Test
public void testReserveAvailableResources() {
final SlotSharingSlotAllocator slotAllocator = SlotSharingSlotAllocator.createSlotSharingSlotAllocator(TEST_RESERVE_SLOT_FUNCTION, TEST_FREE_SLOT_FUNCTION, TEST_IS_SLOT_FREE_FUNCTION);
final JobInformation jobInformation = new TestJobInformation(Arrays.asList(vertex1, vertex2, vertex3));
final VertexParallelismWithSlotSharing slotAssignments = slotAllocator.determineParallelism(jobInformation, getSlots(50)).get();
final ReservedSlots reservedSlots = slotAllocator.tryReserveResources(slotAssignments).orElseThrow(() -> new RuntimeException("Expected that reservation succeeds."));
final Map<ExecutionVertexID, SlotInfo> expectedAssignments = new HashMap<>();
for (SlotSharingSlotAllocator.ExecutionSlotSharingGroupAndSlot assignment : slotAssignments.getAssignments()) {
for (ExecutionVertexID containedExecutionVertex : assignment.getExecutionSlotSharingGroup().getContainedExecutionVertices()) {
expectedAssignments.put(containedExecutionVertex, assignment.getSlotInfo());
}
}
for (Map.Entry<ExecutionVertexID, SlotInfo> expectedAssignment : expectedAssignments.entrySet()) {
final LogicalSlot assignedSlot = reservedSlots.getSlotFor(expectedAssignment.getKey());
final SlotInfo backingSlot = expectedAssignment.getValue();
assertThat(assignedSlot.getAllocationId(), is(backingSlot.getAllocationId()));
}
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink by apache.
the class PipelinedRegionExecutionViewTest method finishingUnknownVertexThrowsException.
@Test(expected = IllegalArgumentException.class)
public void finishingUnknownVertexThrowsException() {
final PipelinedRegionExecutionView pipelinedRegionExecutionView = new PipelinedRegionExecutionView(TEST_PIPELINED_REGION);
final ExecutionVertexID unknownVertexId = new ExecutionVertexID(new JobVertexID(), 0);
pipelinedRegionExecutionView.vertexFinished(unknownVertexId);
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink by apache.
the class RegionPartitionGroupReleaseStrategyTest method toggleVertexFinishedUnfinished.
@Test
public void toggleVertexFinishedUnfinished() {
final List<TestingSchedulingExecutionVertex> producers = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingExecutionVertex> consumers = testingSchedulingTopology.addExecutionVertices().withParallelism(2).finish();
testingSchedulingTopology.connectAllToAll(producers, consumers).finish();
final ExecutionVertexID consumerVertex1 = consumers.get(0).getId();
final ExecutionVertexID consumerVertex2 = consumers.get(1).getId();
final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
regionPartitionGroupReleaseStrategy.vertexFinished(consumerVertex1);
regionPartitionGroupReleaseStrategy.vertexFinished(consumerVertex2);
regionPartitionGroupReleaseStrategy.vertexUnfinished(consumerVertex2);
final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, consumerVertex1);
assertThat(partitionsToRelease, is(empty()));
}
Aggregations