/** * Reattaches to a running job with the given job id. * * @param jobID The job id of the job to attach to * @return The JobExecutionResult for the jobID * @throws JobExecutionException if an error occurs during monitoring the job execution */ public JobListeningContext connectToJob(JobID jobID) throws JobExecutionException { final ActorSystem actorSystem; try { actorSystem = actorSystemLoader.get(); } catch (FlinkException fe) { throw new JobExecutionException( jobID, "Could not start the ActorSystem needed to talk to the JobManager.", fe); } return JobClient.attachToRunningJob( jobID, flinkConfig, actorSystem, highAvailabilityServices, timeout, printStatusDuringExecution); }
throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), jobGraph.getJobID(), e);
@Test public void testSuccessfulProgramAfterFailure() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); runConnectedComponents(env); try { runKMeans(env); fail("This program execution should have failed."); } catch (JobExecutionException e) { assertTrue(e.getCause().getMessage().contains("Insufficient number of network buffers")); } runConnectedComponents(env); }
/** * Reattaches to a running from the supplied job id. * @param jobID The job id of the job to attach to * @return The JobExecutionResult for the jobID * @throws JobExecutionException if an error occurs during monitoring the job execution */ public JobExecutionResult retrieveJob(JobID jobID) throws JobExecutionException { final ActorSystem actorSystem; try { actorSystem = actorSystemLoader.get(); } catch (FlinkException fe) { throw new JobExecutionException( jobID, "Could not start the ActorSystem needed to talk to the JobManager.", fe); } final JobListeningContext listeningContext = JobClient.attachToRunningJob( jobID, flinkConfig, actorSystem, highAvailabilityServices, timeout, printStatusDuringExecution); return JobClient.awaitJobResult(listeningContext); }
/** * Submits a JobGraph detached. * @param jobGraph The JobGraph * @param classLoader User code class loader to deserialize the results and errors (may contain custom classes). * @return JobSubmissionResult * @throws ProgramInvocationException */ public JobSubmissionResult runDetached(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException { waitForClusterToBeReady(); final ActorGateway jobManagerGateway; try { jobManagerGateway = getJobManagerGateway(); } catch (Exception e) { throw new ProgramInvocationException("Failed to retrieve the JobManager gateway.", jobGraph.getJobID(), e); } try { logAndSysout("Submitting Job with JobID: " + jobGraph.getJobID() + ". Returning after job submission."); JobClient.submitJobDetached( new AkkaJobManagerGateway(jobManagerGateway), flinkConfig, jobGraph, Time.milliseconds(timeout.toMillis()), classLoader); return new JobSubmissionResult(jobGraph.getJobID()); } catch (JobExecutionException e) { throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), jobGraph.getJobID(), e); } }
kafkaServer.getVersion().equals("0.11") || kafkaServer.getVersion().equals("2.0")) { assertTrue(jee.getCause() instanceof TimeoutException); TimeoutException te = (TimeoutException) jee.getCause(); assertTrue(jee.getCause() instanceof RuntimeException); RuntimeException re = (RuntimeException) jee.getCause();
public JobExecutionResult getResult() throws JobExecutionException, InterruptedException { jobMastersToWaitFor.await(); final Throwable jobFailureCause = this.jobException; final Throwable runnerException = this.runnerException; final JobExecutionResult result = this.result; // (1) we check if the job terminated with an exception // (2) we check whether the job completed successfully // (3) we check if we have exceptions from the JobManagers. the job may still have // completed successfully in that case, if multiple JobMasters were running // and other took over. only if all encounter a fatal error, the job cannot finish if (jobFailureCause != null) { if (jobFailureCause instanceof JobExecutionException) { throw (JobExecutionException) jobFailureCause; } else { throw new JobExecutionException(jobId, "The job execution failed", jobFailureCause); } } else if (result != null) { return result; } else if (runnerException != null) { throw new JobExecutionException(jobId, "The job execution failed because all JobManagers encountered fatal errors", runnerException); } else { throw new IllegalStateException("Bug: Job finished with neither error nor result."); } } }
throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), e);
/** * Reattaches to a running job with the given job id. * * @param jobID The job id of the job to attach to * @return The JobExecutionResult for the jobID * @throws JobExecutionException if an error occurs during monitoring the job execution */ public JobListeningContext connectToJob(JobID jobID) throws JobExecutionException { final ActorSystem actorSystem; try { actorSystem = actorSystemLoader.get(); } catch (FlinkException fe) { throw new JobExecutionException( jobID, "Could not start the ActorSystem needed to talk to the JobManager.", fe); } return JobClient.attachToRunningJob( jobID, flinkConfig, actorSystem, highAvailabilityServices, timeout, printStatusDuringExecution); }
throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), e);
@Test public void testNullValues() { try { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); env.getConfig().disableSysoutLogging(); DataSet<String> data = env.fromElements("hallo") .map(new MapFunction<String, String>() { @Override public String map(String value) throws Exception { return null; } }); data.writeAsText("/tmp/myTest", FileSystem.WriteMode.OVERWRITE); try { env.execute(); fail("this should fail due to null values."); } catch (JobExecutionException e) { assertNotNull(e.getCause()); assertTrue(e.getCause() instanceof NullPointerException); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
/** * Reattaches to a running job with the given job id. * * @param jobID The job id of the job to attach to * @return The JobExecutionResult for the jobID * @throws JobExecutionException if an error occurs during monitoring the job execution */ public JobListeningContext connectToJob(JobID jobID) throws JobExecutionException { final ActorSystem actorSystem; try { actorSystem = actorSystemLoader.get(); } catch (FlinkException fe) { throw new JobExecutionException( jobID, "Could not start the ActorSystem needed to talk to the JobManager.", fe); } return JobClient.attachToRunningJob( jobID, flinkConfig, actorSystem, highAvailabilityServices, timeout, printStatusDuringExecution); }
/** * Submits a JobGraph detached. * @param jobGraph The JobGraph * @param classLoader User code class loader to deserialize the results and errors (may contain custom classes). * @return JobSubmissionResult * @throws ProgramInvocationException */ public JobSubmissionResult runDetached(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException { waitForClusterToBeReady(); final ActorGateway jobManagerGateway; try { jobManagerGateway = getJobManagerGateway(); } catch (Exception e) { throw new ProgramInvocationException("Failed to retrieve the JobManager gateway.", e); } try { logAndSysout("Submitting Job with JobID: " + jobGraph.getJobID() + ". Returning after job submission."); JobClient.submitJobDetached(jobManagerGateway, flinkConfig, jobGraph, timeout, classLoader); return new JobSubmissionResult(jobGraph.getJobID()); } catch (JobExecutionException e) { throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), e); } }
@Override protected void testProgram() throws Exception { //test failing version try { executeTask(new FailingTestMapper(), 1); } catch (RuntimeException e) { //expected for collection execution if (!isCollectionExecution()) { Assert.fail(); } // for collection execution, no restarts. So, exception should be appended with 0. Assert.assertEquals(EXCEPTION_STRING + ":0", e.getMessage()); } catch (JobExecutionException e) { //expected for cluster execution if (isCollectionExecution()) { Assert.fail(); } // for cluster execution, one restart. So, exception should be appended with 1. Assert.assertEquals(EXCEPTION_STRING + ":1", e.getCause().getMessage()); } //test correct version executeTask(new TestMapper(), 0); }
exception = new JobExecutionException(jobId, "Job execution failed.", cause); } else if (applicationStatus == ApplicationStatus.CANCELED) { exception = new JobCancellationException(jobId, "Job was cancelled.", cause); } else { exception = new JobExecutionException(jobId, "Job completed with illegal application status: " + applicationStatus + '.', cause);
throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), jobGraph.getJobID(), e);
exception = new JobExecutionException(jobId, "Job execution failed.", cause); } else if (applicationStatus == ApplicationStatus.CANCELED) { exception = new JobCancellationException(jobId, "Job was cancelled.", cause); } else { exception = new JobExecutionException(jobId, "Job completed with illegal application status: " + applicationStatus + '.', cause);
/** * Submits a JobGraph detached. * @param jobGraph The JobGraph * @param classLoader User code class loader to deserialize the results and errors (may contain custom classes). * @return JobSubmissionResult * @throws ProgramInvocationException */ public JobSubmissionResult runDetached(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException { waitForClusterToBeReady(); final ActorGateway jobManagerGateway; try { jobManagerGateway = getJobManagerGateway(); } catch (Exception e) { throw new ProgramInvocationException("Failed to retrieve the JobManager gateway.", e); } try { logAndSysout("Submitting Job with JobID: " + jobGraph.getJobID() + ". Returning after job submission."); JobClient.submitJobDetached( new AkkaJobManagerGateway(jobManagerGateway), flinkConfig, jobGraph, Time.milliseconds(timeout.toMillis()), classLoader); return new JobSubmissionResult(jobGraph.getJobID()); } catch (JobExecutionException e) { throw new ProgramInvocationException("The program execution failed: " + e.getMessage(), e); } }