dalelane commented on code in PR #1238:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1238#discussion_r4422595208
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java:
##########
@@ -853,13 +851,25 @@ private void populateStateSize(
var parameters =
checkpointingStatisticsHeaders.getUnresolvedMessageParameters();
parameters.jobPathParameter.resolve(JobID.fromHexString(jobId));
- CheckpointingStatistics checkpointingStatistics =
- clusterClient
- .sendRequest(
- checkpointingStatisticsHeaders,
- parameters,
- EmptyRequestBody.getInstance())
- .get();
+ CheckpointingStatistics checkpointingStatistics;
+ try {
+ checkpointingStatistics =
+ clusterClient
+ .sendRequest(
+ checkpointingStatisticsHeaders,
+ parameters,
+ EmptyRequestBody.getInstance())
+ .get(
+
operatorConfig.getFlinkClientTimeout().toSeconds(),
+ TimeUnit.SECONDS);
+ } catch (ExecutionException e) {
+ if (isCheckpointingDisabled(e)) {
+ LOG.debug(
+ "Checkpointing not enabled for job {},
skipping state size", jobId);
+ return;
+ }
+ throw e;
Review Comment:
A test would be useful for this branch - for example, if the statistics
request fails for any other reason we could assert that we get the exception
```java
checkpointingStatisticsResponse.set(
CompletableFuture.failedFuture(
new RestClientException(
"Internal server error",
HttpResponseStatus.INTERNAL_SERVER_ERROR)));
assertThrows(
ExecutionException.class,
() -> flinkService.getClusterInfo(conf,
JobID.generate().toHexString()));
```
##########
flink-kubernetes-operator/src/test/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkServiceTest.java:
##########
@@ -1264,6 +1267,16 @@ public void getClusterInfoTest() throws Exception {
.put(AbstractFlinkService.FIELD_NAME_STATE_SIZE,
"42424242")
.build(),
flinkService.getClusterInfo(conf,
JobID.generate().toHexString()).getInfo());
+
+ // Jobs without checkpointing (e.g. batch jobs) have no checkpoint
statistics
+ checkpointingStatisticsResponse.set(
+ CompletableFuture.failedFuture(
+ new RestClientException(
+ "[Checkpointing has not been enabled.]",
Review Comment:
```suggestion
"[org.apache.flink.runtime.rest.handler.RestHandlerException: Checkpointing has
not been enabled.]",
```
arguably unnecessary given that the substring check matches both, but it
would let the test record exactly what the JobManager returns
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]