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;
}
Aggregations