use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobMaster method notifyOfNewResourceManagerLeader.
private void notifyOfNewResourceManagerLeader(final String newResourceManagerAddress, final ResourceManagerId resourceManagerId) {
resourceManagerAddress = createResourceManagerAddress(newResourceManagerAddress, resourceManagerId);
reconnectToResourceManager(new FlinkException(String.format("ResourceManager leader changed to new address %s", resourceManagerAddress)));
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobMasterServiceLeadershipRunner method stopJobMasterServiceProcess.
@GuardedBy("lock")
private CompletableFuture<Void> stopJobMasterServiceProcess() {
LOG.debug("Stop current JobMasterServiceProcess because the leadership has been revoked.");
jobMasterGatewayFuture.completeExceptionally(new FlinkException("Cannot obtain JobMasterGateway because the JobMaster lost leadership."));
jobMasterGatewayFuture = new CompletableFuture<>();
hasCurrentLeaderBeenCancelled = false;
return jobMasterServiceProcess.closeAsync();
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class JobMasterServiceLeadershipRunner method onJobCompletion.
@GuardedBy("lock")
private void onJobCompletion(JobManagerRunnerResult jobManagerRunnerResult, Throwable throwable) {
state = State.JOB_COMPLETED;
LOG.debug("Completing the result for job {}.", getJobID());
if (throwable != null) {
resultFuture.completeExceptionally(throwable);
jobMasterGatewayFuture.completeExceptionally(new FlinkException("Could not retrieve JobMasterGateway because the JobMaster failed.", throwable));
} else {
if (!jobManagerRunnerResult.isSuccess()) {
jobMasterGatewayFuture.completeExceptionally(new FlinkException("Could not retrieve JobMasterGateway because the JobMaster initialization failed.", jobManagerRunnerResult.getInitializationFailure()));
}
resultFuture.complete(jobManagerRunnerResult);
}
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class SourceCoordinator method handleEventFromOperator.
@Override
public void handleEventFromOperator(int subtask, OperatorEvent event) {
runInEventLoop(() -> {
if (event instanceof RequestSplitEvent) {
LOG.info("Source {} received split request from parallel task {}", operatorName, subtask);
enumerator.handleSplitRequest(subtask, ((RequestSplitEvent) event).hostName());
} else if (event instanceof SourceEventWrapper) {
final SourceEvent sourceEvent = ((SourceEventWrapper) event).getSourceEvent();
LOG.debug("Source {} received custom event from parallel task {}: {}", operatorName, subtask, sourceEvent);
enumerator.handleSourceEvent(subtask, sourceEvent);
} else if (event instanceof ReaderRegistrationEvent) {
final ReaderRegistrationEvent registrationEvent = (ReaderRegistrationEvent) event;
LOG.info("Source {} registering reader for parallel task {} @ {}", operatorName, subtask, registrationEvent.location());
handleReaderRegistrationEvent(registrationEvent);
} else if (event instanceof ReportedWatermarkEvent) {
handleReportedWatermark(subtask, new Watermark(((ReportedWatermarkEvent) event).getWatermark()));
} else {
throw new FlinkException("Unrecognized Operator Event: " + event);
}
}, "handling operator event %s from subtask %d", event, subtask);
}
use of org.apache.flink.util.FlinkException in project flink by apache.
the class TaskSlotTableImpl method closeAsync.
@Override
public CompletableFuture<Void> closeAsync() {
if (state == State.CREATED) {
state = State.CLOSED;
closingFuture.complete(null);
} else if (state == State.RUNNING) {
state = State.CLOSING;
final FlinkException cause = new FlinkException("Closing task slot table");
CompletableFuture<Void> cleanupFuture = FutureUtils.waitForAll(new ArrayList<>(allocatedSlots.values()).stream().map(slot -> freeSlotInternal(slot, cause)).collect(Collectors.toList())).thenRunAsync(() -> {
state = State.CLOSED;
timerService.stop();
}, mainThreadExecutor);
FutureUtils.forward(cleanupFuture, closingFuture);
}
return closingFuture;
}
Aggregations