use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.
the class DefaultScheduler method deployOrHandleError.
private BiFunction<Object, Throwable, Void> deployOrHandleError(final DeploymentHandle deploymentHandle) {
final ExecutionVertexVersion requiredVertexVersion = deploymentHandle.getRequiredVertexVersion();
final ExecutionVertexID executionVertexId = requiredVertexVersion.getExecutionVertexId();
return (ignored, throwable) -> {
if (executionVertexVersioner.isModified(requiredVertexVersion)) {
log.debug("Refusing to deploy execution vertex {} because this deployment was " + "superseded by another deployment", executionVertexId);
return null;
}
if (throwable == null) {
deployTaskSafe(executionVertexId);
} else {
handleTaskDeploymentFailure(executionVertexId, throwable);
}
return null;
};
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.
the class LocalInputPreferredSlotSharingStrategy method notifySchedulingTopologyUpdated.
@Override
public void notifySchedulingTopologyUpdated(SchedulingTopology schedulingTopology, List<ExecutionVertexID> newExecutionVertices) {
final Map<ExecutionVertexID, ExecutionSlotSharingGroup> newMap = new LocalInputPreferredSlotSharingStrategy.ExecutionSlotSharingGroupBuilder(schedulingTopology, logicalSlotSharingGroups, coLocationGroups).build();
for (ExecutionVertexID vertexId : newMap.keySet()) {
final ExecutionSlotSharingGroup newEssg = newMap.get(vertexId);
final ExecutionSlotSharingGroup oldEssg = executionSlotSharingGroupMap.get(vertexId);
if (oldEssg == null) {
executionSlotSharingGroupMap.put(vertexId, newEssg);
} else {
// ensures that existing slot sharing groups are not changed
checkState(oldEssg.getExecutionVertexIds().equals(newEssg.getExecutionVertexIds()), "Existing ExecutionSlotSharingGroups are changed after topology update");
}
}
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.
the class RegionPartitionGroupReleaseStrategyTest method releasePartitionsIfDownstreamRegionWithMultipleOperatorsIsFinished.
@Test
public void releasePartitionsIfDownstreamRegionWithMultipleOperatorsIsFinished() {
final List<TestingSchedulingExecutionVertex> sourceVertices = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingExecutionVertex> intermediateVertices = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingExecutionVertex> sinkVertices = testingSchedulingTopology.addExecutionVertices().finish();
final List<TestingSchedulingResultPartition> sourceResultPartitions = testingSchedulingTopology.connectAllToAll(sourceVertices, intermediateVertices).finish();
testingSchedulingTopology.connectAllToAll(intermediateVertices, sinkVertices).withResultPartitionType(ResultPartitionType.PIPELINED).finish();
final ExecutionVertexID onlyIntermediateVertexId = intermediateVertices.get(0).getId();
final ExecutionVertexID onlySinkVertexId = sinkVertices.get(0).getId();
final IntermediateResultPartitionID onlySourceResultPartitionId = sourceResultPartitions.get(0).getId();
final RegionPartitionGroupReleaseStrategy regionPartitionGroupReleaseStrategy = new RegionPartitionGroupReleaseStrategy(testingSchedulingTopology);
regionPartitionGroupReleaseStrategy.vertexFinished(onlyIntermediateVertexId);
final List<IntermediateResultPartitionID> partitionsToRelease = getReleasablePartitions(regionPartitionGroupReleaseStrategy, onlySinkVertexId);
assertThat(partitionsToRelease, contains(onlySourceResultPartitionId));
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.
the class ExecutionFailureHandlerTest method testNonRecoverableFailureHandlingResult.
/**
* Tests the case that the failure is non-recoverable type.
*/
@Test
public void testNonRecoverableFailureHandlingResult() {
// trigger an unrecoverable task failure
final Throwable error = new Exception(new SuppressRestartsException(new Exception("test failure")));
final long timestamp = System.currentTimeMillis();
final FailureHandlingResult result = executionFailureHandler.getFailureHandlingResult(new ExecutionVertexID(new JobVertexID(), 0), error, timestamp);
// verify results
assertFalse(result.canRestart());
assertNotNull(result.getError());
assertTrue(ExecutionFailureHandler.isUnrecoverableError(result.getError()));
assertThat(result.getTimestamp(), is(timestamp));
try {
result.getVerticesToRestart();
fail("get tasks to restart is not allowed when restarting is suppressed");
} catch (IllegalStateException ex) {
// expected
}
try {
result.getRestartDelayMS();
fail("get restart delay is not allowed when restarting is suppressed");
} catch (IllegalStateException ex) {
// expected
}
assertEquals(0, executionFailureHandler.getNumberOfRestarts());
}
use of org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID in project flink-mirror by flink-ci.
the class ExecutionFailureHandlerTest method testRestartingSuppressedFailureHandlingResult.
/**
* Tests the case that task restarting is suppressed.
*/
@Test
public void testRestartingSuppressedFailureHandlingResult() {
// restart strategy suppresses restarting
backoffTimeStrategy.setCanRestart(false);
// trigger a task failure
final Throwable error = new Exception("expected test failure");
final long timestamp = System.currentTimeMillis();
final FailureHandlingResult result = executionFailureHandler.getFailureHandlingResult(new ExecutionVertexID(new JobVertexID(), 0), error, timestamp);
// verify results
assertFalse(result.canRestart());
assertThat(result.getError(), containsCause(error));
assertThat(result.getTimestamp(), is(timestamp));
assertFalse(ExecutionFailureHandler.isUnrecoverableError(result.getError()));
try {
result.getVerticesToRestart();
fail("get tasks to restart is not allowed when restarting is suppressed");
} catch (IllegalStateException ex) {
// expected
}
try {
result.getRestartDelayMS();
fail("get restart delay is not allowed when restarting is suppressed");
} catch (IllegalStateException ex) {
// expected
}
assertEquals(0, executionFailureHandler.getNumberOfRestarts());
}
Aggregations