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