Search in sources :

Example 1 with ResourceManagerRunner

use of org.apache.flink.runtime.resourcemanager.ResourceManagerRunner in project flink by apache.

the class MiniCluster method shutdownInternally.

@GuardedBy("lock")
private void shutdownInternally() throws Exception {
    // this should always be called under the lock
    assert Thread.holdsLock(lock);
    // collect the first exception, but continue and add all successive
    // exceptions as suppressed
    Throwable exception = null;
    // cancel all jobs and shut down the job dispatcher
    if (jobDispatcher != null) {
        try {
            jobDispatcher.shutdown();
        } catch (Exception e) {
            exception = e;
        }
        jobDispatcher = null;
    }
    if (resourceManagerRunners != null) {
        for (ResourceManagerRunner rm : resourceManagerRunners) {
            if (rm != null) {
                try {
                    rm.shutDown();
                } catch (Throwable t) {
                    exception = firstOrSuppressed(t, exception);
                }
            }
        }
        resourceManagerRunners = null;
    }
    if (taskManagerRunners != null) {
        for (TaskManagerRunner tm : taskManagerRunners) {
            if (tm != null) {
                try {
                    tm.shutDown(null);
                } catch (Throwable t) {
                    exception = firstOrSuppressed(t, exception);
                }
            }
        }
        taskManagerRunners = null;
    }
    // shut down the RpcServices
    exception = shutDownRpc(commonRpcService, exception);
    exception = shutDownRpcs(jobManagerRpcServices, exception);
    exception = shutDownRpcs(taskManagerRpcServices, exception);
    exception = shutDownRpcs(resourceManagerRpcServices, exception);
    commonRpcService = null;
    jobManagerRpcServices = null;
    taskManagerRpcServices = null;
    resourceManagerRpcServices = null;
    // shut down high-availability services
    if (haServices != null) {
        try {
            haServices.closeAndCleanupAllData();
        } catch (Exception e) {
            exception = firstOrSuppressed(e, exception);
        }
        haServices = null;
    }
    // metrics shutdown
    if (metricRegistry != null) {
        metricRegistry.shutdown();
        metricRegistry = null;
    }
    // if anything went wrong, throw the first error with all the additional suppressed exceptions
    if (exception != null) {
        ExceptionUtils.rethrowException(exception, "Error while shutting down mini cluster");
    }
}
Also used : ResourceManagerRunner(org.apache.flink.runtime.resourcemanager.ResourceManagerRunner) TaskManagerRunner(org.apache.flink.runtime.taskexecutor.TaskManagerRunner) JobExecutionException(org.apache.flink.runtime.client.JobExecutionException) GuardedBy(javax.annotation.concurrent.GuardedBy)

Example 2 with ResourceManagerRunner

use of org.apache.flink.runtime.resourcemanager.ResourceManagerRunner in project flink by apache.

the class MiniCluster method startResourceManagers.

protected ResourceManagerRunner[] startResourceManagers(Configuration configuration, HighAvailabilityServices haServices, MetricRegistry metricRegistry, int numResourceManagers, RpcService[] resourceManagerRpcServices) throws Exception {
    final ResourceManagerRunner[] resourceManagerRunners = new ResourceManagerRunner[numResourceManagers];
    for (int i = 0; i < numResourceManagers; i++) {
        resourceManagerRunners[i] = new ResourceManagerRunner(configuration, resourceManagerRpcServices[i], haServices, metricRegistry);
        resourceManagerRunners[i].start();
    }
    return resourceManagerRunners;
}
Also used : ResourceManagerRunner(org.apache.flink.runtime.resourcemanager.ResourceManagerRunner)

Aggregations

ResourceManagerRunner (org.apache.flink.runtime.resourcemanager.ResourceManagerRunner)2 GuardedBy (javax.annotation.concurrent.GuardedBy)1 JobExecutionException (org.apache.flink.runtime.client.JobExecutionException)1 TaskManagerRunner (org.apache.flink.runtime.taskexecutor.TaskManagerRunner)1