Search in sources :

Example 1 with JobAccumulatorsHeaders

use of org.apache.flink.runtime.rest.messages.JobAccumulatorsHeaders in project flink by apache.

the class RestClusterClient method getAccumulators.

@Override
public CompletableFuture<Map<String, Object>> getAccumulators(JobID jobID, ClassLoader loader) {
    final JobAccumulatorsHeaders accumulatorsHeaders = JobAccumulatorsHeaders.getInstance();
    final JobAccumulatorsMessageParameters accMsgParams = accumulatorsHeaders.getUnresolvedMessageParameters();
    accMsgParams.jobPathParameter.resolve(jobID);
    accMsgParams.includeSerializedAccumulatorsParameter.resolve(Collections.singletonList(true));
    CompletableFuture<JobAccumulatorsInfo> responseFuture = sendRequest(accumulatorsHeaders, accMsgParams);
    return responseFuture.thenApply(JobAccumulatorsInfo::getSerializedUserAccumulators).thenApply(accumulators -> {
        try {
            return AccumulatorHelper.deserializeAndUnwrapAccumulators(accumulators, loader);
        } catch (Exception e) {
            throw new CompletionException("Cannot deserialize and unwrap accumulators properly.", e);
        }
    });
}
Also used : JobAccumulatorsMessageParameters(org.apache.flink.runtime.rest.messages.JobAccumulatorsMessageParameters) CompletionException(java.util.concurrent.CompletionException) JobAccumulatorsInfo(org.apache.flink.runtime.rest.messages.JobAccumulatorsInfo) JobAccumulatorsHeaders(org.apache.flink.runtime.rest.messages.JobAccumulatorsHeaders) JobSubmissionException(org.apache.flink.runtime.client.JobSubmissionException) ConnectTimeoutException(org.apache.flink.shaded.netty4.io.netty.channel.ConnectTimeoutException) FlinkException(org.apache.flink.util.FlinkException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) RestClientException(org.apache.flink.runtime.rest.util.RestClientException) CompletionException(java.util.concurrent.CompletionException) MalformedURLException(java.net.MalformedURLException)

Aggregations

IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 CompletionException (java.util.concurrent.CompletionException)1 ExecutionException (java.util.concurrent.ExecutionException)1 JobSubmissionException (org.apache.flink.runtime.client.JobSubmissionException)1 JobAccumulatorsHeaders (org.apache.flink.runtime.rest.messages.JobAccumulatorsHeaders)1 JobAccumulatorsInfo (org.apache.flink.runtime.rest.messages.JobAccumulatorsInfo)1 JobAccumulatorsMessageParameters (org.apache.flink.runtime.rest.messages.JobAccumulatorsMessageParameters)1 RestClientException (org.apache.flink.runtime.rest.util.RestClientException)1 ConnectTimeoutException (org.apache.flink.shaded.netty4.io.netty.channel.ConnectTimeoutException)1 FlinkException (org.apache.flink.util.FlinkException)1