Search in sources :

Example 46 with FlinkException

use of org.apache.flink.util.FlinkException in project flink by apache.

the class CliFrontend method disposeSavepoint.

/**
 * Sends a SavepointDisposalRequest to the job manager.
 */
private void disposeSavepoint(ClusterClient<?> clusterClient, String savepointPath) throws FlinkException {
    checkNotNull(savepointPath, "Missing required argument: savepoint path. " + "Usage: bin/flink savepoint -d <savepoint-path>");
    logAndSysout("Disposing savepoint '" + savepointPath + "'.");
    final CompletableFuture<Acknowledge> disposeFuture = clusterClient.disposeSavepoint(savepointPath);
    logAndSysout("Waiting for response...");
    try {
        disposeFuture.get(clientTimeout.toMillis(), TimeUnit.MILLISECONDS);
    } catch (Exception e) {
        throw new FlinkException("Disposing the savepoint '" + savepointPath + "' failed.", e);
    }
    logAndSysout("Savepoint '" + savepointPath + "' disposed.");
}
Also used : Acknowledge(org.apache.flink.runtime.messages.Acknowledge) ProgramInvocationException(org.apache.flink.client.program.ProgramInvocationException) ProgramMissingJobException(org.apache.flink.client.program.ProgramMissingJobException) InvalidProgramException(org.apache.flink.api.common.InvalidProgramException) ProgramParametrizationException(org.apache.flink.client.program.ProgramParametrizationException) FileNotFoundException(java.io.FileNotFoundException) FlinkException(org.apache.flink.util.FlinkException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) FlinkException(org.apache.flink.util.FlinkException)

Example 47 with FlinkException

use of org.apache.flink.util.FlinkException in project flink by apache.

the class FineGrainedSlotManager method releaseIdleTaskExecutor.

private void releaseIdleTaskExecutor(InstanceID timedOutTaskManagerId) {
    final FlinkException cause = new FlinkException("TaskManager exceeded the idle timeout.");
    resourceActions.releaseResource(timedOutTaskManagerId, cause);
}
Also used : FlinkException(org.apache.flink.util.FlinkException)

Example 48 with FlinkException

use of org.apache.flink.util.FlinkException in project flink by apache.

the class TaskExecutor method freeNoLongerUsedSlots.

private void freeNoLongerUsedSlots(AllocatedSlotReport allocatedSlotReport) {
    final Set<AllocationID> activeSlots = taskSlotTable.getActiveTaskSlotAllocationIdsPerJob(allocatedSlotReport.getJobId());
    final Set<AllocationID> reportedSlots = allocatedSlotReport.getAllocatedSlotInfos().stream().map(AllocatedSlotInfo::getAllocationId).collect(Collectors.toSet());
    final Sets.SetView<AllocationID> difference = Sets.difference(activeSlots, reportedSlots);
    for (AllocationID allocationID : difference) {
        freeSlotInternal(allocationID, new FlinkException(String.format("%s is no longer allocated by job %s.", allocationID, allocatedSlotReport.getJobId())));
    }
}
Also used : Sets(org.apache.flink.shaded.guava30.com.google.common.collect.Sets) AllocationID(org.apache.flink.runtime.clusterframework.types.AllocationID) FlinkException(org.apache.flink.util.FlinkException)

Example 49 with FlinkException

use of org.apache.flink.util.FlinkException in project flink by apache.

the class TaskManagerRunner method runTaskManager.

public static int runTaskManager(Configuration configuration, PluginManager pluginManager) throws Exception {
    final TaskManagerRunner taskManagerRunner;
    try {
        taskManagerRunner = new TaskManagerRunner(configuration, pluginManager, TaskManagerRunner::createTaskExecutorService);
        taskManagerRunner.start();
    } catch (Exception exception) {
        throw new FlinkException("Failed to start the TaskManagerRunner.", exception);
    }
    try {
        return taskManagerRunner.getTerminationFuture().get().getExitCode();
    } catch (Throwable t) {
        throw new FlinkException("Unexpected failure during runtime of TaskManagerRunner.", ExceptionUtils.stripExecutionException(t));
    }
}
Also used : LeaderRetrievalException(org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException) FlinkException(org.apache.flink.util.FlinkException) IOException(java.io.IOException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) ExecutionException(java.util.concurrent.ExecutionException) FlinkParseException(org.apache.flink.runtime.entrypoint.FlinkParseException) FlinkException(org.apache.flink.util.FlinkException)

Example 50 with FlinkException

use of org.apache.flink.util.FlinkException in project flink by apache.

the class TaskManagerServices method shutDown.

// --------------------------------------------------------------------------------------------
// Shut down method
// --------------------------------------------------------------------------------------------
/**
 * Shuts the {@link TaskExecutor} services down.
 */
public void shutDown() throws FlinkException {
    Exception exception = null;
    try {
        taskManagerStateStore.shutdown();
    } catch (Exception e) {
        exception = e;
    }
    try {
        ioManager.close();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        shuffleEnvironment.close();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        kvStateService.shutdown();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        taskSlotTable.close();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        jobLeaderService.stop();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        ioExecutor.shutdown();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        jobTable.close();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    try {
        libraryCacheManager.shutdown();
    } catch (Exception e) {
        exception = ExceptionUtils.firstOrSuppressed(e, exception);
    }
    taskEventDispatcher.clearAll();
    if (exception != null) {
        throw new FlinkException("Could not properly shut down the TaskManager services.", exception);
    }
}
Also used : FlinkException(org.apache.flink.util.FlinkException) IOException(java.io.IOException) FlinkException(org.apache.flink.util.FlinkException)

Aggregations

FlinkException (org.apache.flink.util.FlinkException)197 Test (org.junit.Test)91 CompletableFuture (java.util.concurrent.CompletableFuture)59 IOException (java.io.IOException)38 ExecutionException (java.util.concurrent.ExecutionException)26 ArrayList (java.util.ArrayList)25 JobID (org.apache.flink.api.common.JobID)24 Collection (java.util.Collection)22 CompletionException (java.util.concurrent.CompletionException)22 Configuration (org.apache.flink.configuration.Configuration)21 TimeoutException (java.util.concurrent.TimeoutException)19 FutureUtils (org.apache.flink.util.concurrent.FutureUtils)19 Time (org.apache.flink.api.common.time.Time)16 OneShotLatch (org.apache.flink.core.testutils.OneShotLatch)16 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)16 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)15 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)14 Collections (java.util.Collections)13 List (java.util.List)13 ExecutorService (java.util.concurrent.ExecutorService)13