/** * Utility method to retrieve the BlobServer address from the given JobManager gateway. * * @param jobManagerGateway to obtain the BlobServer address from * @param timeout for this operation * @return CompletableFuture containing the BlobServer address */ public static CompletableFuture<InetSocketAddress> retrieveBlobServerAddress( JobManagerGateway jobManagerGateway, Time timeout) { CompletableFuture<Integer> futureBlobPort = jobManagerGateway.requestBlobServerPort(timeout); final String jmHostname = jobManagerGateway.getHostname(); return futureBlobPort.thenApply( (Integer blobPort) -> new InetSocketAddress(jmHostname, blobPort)); } }
@Override public CompletableFuture<String> handleJsonRequest(Map<String, String> pathParams, Map<String, String> queryParams, JobManagerGateway jobManagerGateway) { return CompletableFuture.supplyAsync( () -> { try { JobID jobId = new JobID(StringUtils.hexStringToByte(pathParams.get("jobid"))); if (jobManagerGateway != null) { jobManagerGateway.cancelJob(jobId, timeout); return "{}"; } else { throw new Exception("No connection to the leading JobManager."); } } catch (Exception e) { throw new CompletionException(new FlinkException("Failed to cancel the job with id: " + pathParams.get("jobid"), e)); } }, executor); } }
.requestClassloadingProps(jobID, timeout); JobManagerMessages.ClassloadingProps props = optProps.get(); InetSocketAddress serverAddress = new InetSocketAddress(jobManager.getHostname(), props.blobManagerPort()); final PermanentBlobCache permanentBlobCache; try {
protected void respondAsLeader(final ChannelHandlerContext ctx, final Routed routed, final JobManagerGateway jobManagerGateway) { if (cache == null) { CompletableFuture<Integer> blobPortFuture = jobManagerGateway.requestBlobServerPort(timeout); cache = blobPortFuture.thenApplyAsync( (Integer port) -> { try { return new TransientBlobCache(config, new InetSocketAddress(jobManagerGateway.getHostname(), port)); } catch (IOException e) { throw new CompletionException(new FlinkException("Could not create TransientBlobCache.", e)); final CompletableFuture<Optional<Instance>> taskManagerFuture = jobManagerGateway.requestTaskManagerInstance(resourceId, timeout);
CompletableFuture<Acknowledge> submissionFuture = jobManagerGateway.submitJob(jobGraph, ListeningBehaviour.DETACHED, timeout);
.cancelJobWithSavepoint(jobId, targetDirectory, Time.milliseconds(checkpointTimeout));
CompletableFuture<JobIdsWithStatusOverview> overviewFuture = jobManagerGateway.requestJobsOverview(timeout); JobIdsWithStatusOverview overview = overviewFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
@Override public CompletableFuture<String> handleJsonRequest(Map<String, String> pathParams, Map<String, String> queryParams, JobManagerGateway jobManagerGateway) { if (jobManagerGateway != null) { CompletableFuture<MultipleJobsDetails> jobDetailsFuture = jobManagerGateway.requestMultipleJobDetails(timeout); return jobDetailsFuture.thenApplyAsync( (MultipleJobsDetails result) -> { StringWriter writer = new StringWriter(); try { JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer); final JobDetails.JobDetailsSerializer jobDetailsSerializer = new JobDetails.JobDetailsSerializer(); gen.writeStartObject(); gen.writeArrayFieldStart(MultipleJobsDetails.FIELD_NAME_JOBS); for (JobDetails detail : result.getJobs()) { jobDetailsSerializer.serialize(detail, gen, null); } gen.writeEndArray(); gen.writeEndObject(); gen.close(); return writer.toString(); } catch (IOException e) { throw new CompletionException(new FlinkException("Could not write current jobs overview json.", e)); } }, executor); } else { return FutureUtils.completedExceptionally(new Exception("No connection to the leading JobManager.")); } }
CompletableFuture<ClusterOverview> overviewFuture = jobManagerGateway.requestClusterOverview(timeout);
.requestClassloadingProps(jobID, timeout); JobManagerMessages.ClassloadingProps props = optProps.get(); InetSocketAddress serverAddress = new InetSocketAddress(jobManager.getHostname(), props.blobManagerPort()); final PermanentBlobCache permanentBlobCache; try {
CompletableFuture<Acknowledge> submissionFuture = jobManagerGateway.submitJob(jobGraph, ListeningBehaviour.DETACHED, timeout);
/** * Utility method to retrieve the BlobServer address from the given JobManager gateway. * * @param jobManagerGateway to obtain the BlobServer address from * @param timeout for this operation * @return CompletableFuture containing the BlobServer address */ public static CompletableFuture<InetSocketAddress> retrieveBlobServerAddress( JobManagerGateway jobManagerGateway, Time timeout) { CompletableFuture<Integer> futureBlobPort = jobManagerGateway.requestBlobServerPort(timeout); final String jmHostname = jobManagerGateway.getHostname(); return futureBlobPort.thenApply( (Integer blobPort) -> new InetSocketAddress(jmHostname, blobPort)); } }
.requestClassloadingProps(jobID, timeout); JobManagerMessages.ClassloadingProps props = optProps.get(); InetSocketAddress serverAddress = new InetSocketAddress(jobManager.getHostname(), props.blobManagerPort()); final PermanentBlobCache permanentBlobCache; try {
CompletableFuture<Acknowledge> submissionFuture = jobManagerGateway.submitJob(jobGraph, ListeningBehaviour.DETACHED, timeout);
/** * Utility method to retrieve the BlobServer address from the given JobManager gateway. * * @param jobManagerGateway to obtain the BlobServer address from * @param timeout for this operation * @return CompletableFuture containing the BlobServer address */ public static CompletableFuture<InetSocketAddress> retrieveBlobServerAddress( JobManagerGateway jobManagerGateway, Time timeout) { CompletableFuture<Integer> futureBlobPort = jobManagerGateway.requestBlobServerPort(timeout); final String jmHostname = jobManagerGateway.getHostname(); return futureBlobPort.thenApply( (Integer blobPort) -> new InetSocketAddress(jmHostname, blobPort)); } }