/** * 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); }
@Override public void run() { try { JobExecutionResult result = JobClient.submitJobAndWait( clientActorSystem, cluster.configuration(), cluster.highAvailabilityServices(), graph, timeout, false, getClass().getClassLoader()); resultPromise.success(result); } catch (Exception e) { // This was not expected... fail the test case resultPromise.failure(e); } } }
/** * 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); } }
ClassLoader classLoader) throws JobExecutionException { JobListeningContext jobListeningContext = submitJob( actorSystem, config, classLoader); return awaitJobResult(jobListeningContext);
/** * The class loader necessary to deserialize the result of a job execution, * i.e. JobExecutionResult or Exceptions * @return The class loader for the job id * @throws JobRetrievalException if anything goes wrong */ public ClassLoader getClassLoader() throws JobRetrievalException { if (classLoader == null) { // lazily initializes the class loader when it is needed classLoader = JobClient.retrieveClassLoader( jobID, getJobManager(), configuration, highAvailabilityServices); LOG.info("Reconstructed class loader for Job {}", jobID); } return classLoader; }
final CompletableFuture<InetSocketAddress> blobServerAddressFuture = retrieveBlobServerAddress( jobManagerGateway, timeout);
/** * 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); }
ClassLoader classLoader) throws JobExecutionException { JobListeningContext jobListeningContext = submitJob( actorSystem, config, classLoader); return awaitJobResult(jobListeningContext);
/** * The class loader necessary to deserialize the result of a job execution, * i.e. JobExecutionResult or Exceptions * @return The class loader for the job id * @throws JobRetrievalException if anything goes wrong */ public ClassLoader getClassLoader() throws JobRetrievalException { if (classLoader == null) { // lazily initializes the class loader when it is needed classLoader = JobClient.retrieveClassLoader( jobID, new AkkaJobManagerGateway(getJobManager()), configuration, highAvailabilityServices, Time.milliseconds(timeout.toMillis())); LOG.info("Reconstructed class loader for Job {}", jobID); } return classLoader; }
final CompletableFuture<InetSocketAddress> blobServerAddressFuture = retrieveBlobServerAddress( jobManagerGateway, timeout);
/** * 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); }
ClassLoader classLoader) throws JobExecutionException { JobListeningContext jobListeningContext = submitJob( actorSystem, config, classLoader); return awaitJobResult(jobListeningContext);
/** * 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); }
this.lastJobExecutionResult = JobClient.submitJobAndWait( actorSystem, flinkConfig,
@Override public String handleJsonRequest(Map<String, String> pathParams, Map<String, String> queryParams, ActorGateway jobManager) throws Exception { try { JarActionHandlerConfig config = JarActionHandlerConfig.fromParams(pathParams, queryParams); Tuple2<JobGraph, ClassLoader> graph = getJobGraphAndClassLoader(config); try { graph.f0.uploadUserJars(jobManager, timeout, clientConfig); } catch (IOException e) { throw new ProgramInvocationException("Failed to upload jar files to the job manager", e); } try { JobClient.submitJobDetached(jobManager, clientConfig, graph.f0, timeout, graph.f1); } catch (JobExecutionException e) { throw new ProgramInvocationException("Failed to submit the job to the job manager", e); } StringWriter writer = new StringWriter(); JsonGenerator gen = JsonFactory.jacksonFactory.createGenerator(writer); gen.writeStartObject(); gen.writeStringField("jobid", graph.f0.getJobID().toString()); gen.writeEndObject(); gen.close(); return writer.toString(); } catch (Exception e) { return sendError(e); } } }
/** * The class loader necessary to deserialize the result of a job execution, * i.e. JobExecutionResult or Exceptions * @return The class loader for the job id * @throws JobRetrievalException if anything goes wrong */ public ClassLoader getClassLoader() throws JobRetrievalException { if (classLoader == null) { // lazily initializes the class loader when it is needed classLoader = JobClient.retrieveClassLoader( jobID, new AkkaJobManagerGateway(getJobManager()), configuration, highAvailabilityServices, Time.milliseconds(timeout.toMillis())); LOG.info("Reconstructed class loader for Job {}", jobID); } return classLoader; }
final CompletableFuture<InetSocketAddress> blobServerAddressFuture = retrieveBlobServerAddress( jobManagerGateway, timeout);
/** * 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); }
ClassLoader classLoader) throws JobExecutionException { JobListeningContext jobListeningContext = submitJob( actorSystem, config, classLoader); return awaitJobResult(jobListeningContext);
/** * 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); }