Search in sources :

Example 21 with JobExecutionException

use of org.apache.flink.runtime.client.JobExecutionException in project flink by apache.

the class MiniClusterJobDispatcher method startJobRunners.

private JobManagerRunner[] startJobRunners(JobGraph job, OnCompletionActions onCompletion, FatalErrorHandler errorHandler) throws JobExecutionException {
    LOG.info("Starting {} JobMaster(s) for job {} ({})", numJobManagers, job.getName(), job.getJobID());
    // start all JobManagers
    JobManagerRunner[] runners = new JobManagerRunner[numJobManagers];
    for (int i = 0; i < numJobManagers; i++) {
        try {
            runners[i] = new JobManagerRunner(ResourceID.generate(), job, configuration, rpcServices[i], haServices, heartbeatServices, jobManagerServices, metricRegistry, onCompletion, errorHandler);
            runners[i].start();
        } catch (Throwable t) {
            // shut down all the ones so far
            for (int k = 0; k <= i; k++) {
                try {
                    if (runners[i] != null) {
                        runners[i].shutdown();
                    }
                } catch (Throwable ignored) {
                // silent shutdown
                }
            }
            // un-register the job from the high.availability services
            try {
                haServices.getRunningJobsRegistry().setJobFinished(job.getJobID());
            } catch (Throwable tt) {
                LOG.warn("Could not properly unregister job from high-availability services", tt);
            }
            throw new JobExecutionException(job.getJobID(), "Could not start the JobManager(s) for the job", t);
        }
    }
    return runners;
}
Also used : JobExecutionException(org.apache.flink.runtime.client.JobExecutionException) JobManagerRunner(org.apache.flink.runtime.jobmaster.JobManagerRunner)

Aggregations

JobExecutionException (org.apache.flink.runtime.client.JobExecutionException)21 Test (org.junit.Test)10 IOException (java.io.IOException)8 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)7 ProgramInvocationException (org.apache.flink.client.program.ProgramInvocationException)5 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)5 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)4 URISyntaxException (java.net.URISyntaxException)3 JobID (org.apache.flink.api.common.JobID)3 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)3 CompilerException (org.apache.flink.optimizer.CompilerException)3 JobRetrievalException (org.apache.flink.runtime.client.JobRetrievalException)3 ActorGateway (org.apache.flink.runtime.instance.ActorGateway)3 JobManagerMessages (org.apache.flink.runtime.messages.JobManagerMessages)3 TimerException (org.apache.flink.streaming.runtime.tasks.TimerException)3 Properties (java.util.Properties)2 TimeoutException (java.util.concurrent.TimeoutException)2 JobExecutionResult (org.apache.flink.api.common.JobExecutionResult)2 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)2 JobSubmissionException (org.apache.flink.runtime.client.JobSubmissionException)2