[ https://issues.apache.org/jira/browse/FLINK-8756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16406201#comment-16406201 ]
ASF GitHub Bot commented on FLINK-8756: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5573#discussion_r175733724 --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java --- @@ -389,6 +394,36 @@ public String cancelWithSavepoint(JobID jobId, @Nullable String savepointDirecto }); } + @Override + public Map<String, Object> getAccumulators(JobID jobID) throws Exception { + return getAccumulators(jobID, ClassLoader.getSystemClassLoader()); + } + + @Override + public Map<String, Object> getAccumulators(final JobID jobID, ClassLoader loader) throws Exception { + 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 accumulatorsInfo) -> { + if (accumulatorsInfo != null && accumulatorsInfo.getSerializedUserAccumulators() != null) { + try { + return AccumulatorHelper.deserializeAccumulators(accumulatorsInfo.getSerializedUserAccumulators(), loader); + } catch (Exception e) { + log.error("Deserialize accumulators with customized classloader error : {}", e); --- End diff -- Let us properly fail with an exception here. > Support ClusterClient.getAccumulators() in RestClusterClient > ------------------------------------------------------------ > > Key: FLINK-8756 > URL: https://issues.apache.org/jira/browse/FLINK-8756 > Project: Flink > Issue Type: Improvement > Components: Client > Affects Versions: 1.5.0 > Reporter: Aljoscha Krettek > Assignee: vinoyang > Priority: Blocker > Fix For: 1.5.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)