Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5573#discussion_r172651895
--- Diff:
flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
---
@@ -389,6 +394,33 @@ public String cancelWithSavepoint(JobID jobId,
@Nullable String savepointDirecto
});
}
+ @Override
+ public Map<String, Object> getAccumulators(final JobID jobID) throws
Exception {
+ final JobAccumulatorsHeaders accumulatorsHeaders =
JobAccumulatorsHeaders.getInstance();
+ final JobAccumulatorsMessageParameters accMsgParams =
accumulatorsHeaders.getUnresolvedMessageParameters();
+ accMsgParams.jobPathParameter.resolve(jobID);
+
accMsgParams.queryParameter.resolve(Collections.singletonList("true"));
+
+ CompletableFuture<JobAccumulatorsInfo> responseFuture =
sendRequest(
+ accumulatorsHeaders,
+ accMsgParams
+ );
+
+ return responseFuture.thenApply((JobAccumulatorsInfo
accumulatorsInfo) -> {
+ if (accumulatorsInfo != null) {
+ Map<String, Object> result = new HashMap<>(3);
+
+
result.put(JobAccumulatorsInfo.FIELD_NAME_JOB_ACCUMULATORS,
accumulatorsInfo.getJobAccumulators());
--- End diff --
The resulting API (as shown in `RestClusterClientTest`) is effectively not
usable for users and inconsistent with existing behavior in `ClusterClient`.
The returned map should only contain the deserialized accumulators with
their respective name as the key.
---