use of org.apache.flink.runtime.topology.Vertex in project flink by apache.
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.topology.Vertex in project flink by apache.
the class DefaultScheduler method assignResource.
private BiFunction<LogicalSlot, Throwable, LogicalSlot> assignResource(final DeploymentHandle deploymentHandle) {
final ExecutionVertexVersion requiredVertexVersion = deploymentHandle.getRequiredVertexVersion();
final ExecutionVertexID executionVertexId = deploymentHandle.getExecutionVertexId();
return (logicalSlot, throwable) -> {
if (executionVertexVersioner.isModified(requiredVertexVersion)) {
if (throwable == null) {
log.debug("Refusing to assign slot to execution vertex {} because this deployment was " + "superseded by another deployment", executionVertexId);
releaseSlotIfPresent(logicalSlot);
}
return null;
}
// a task which is about to cancel in #restartTasksWithDelay(...)
if (throwable != null) {
throw new CompletionException(maybeWrapWithNoResourceAvailableException(throwable));
}
final ExecutionVertex executionVertex = getExecutionVertex(executionVertexId);
executionVertex.tryAssignResource(logicalSlot);
startReserveAllocation(executionVertexId, logicalSlot.getAllocationId());
return logicalSlot;
};
}
Aggregations