luca-p-castelli commented on code in PR #948:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/948#discussion_r1968243890


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/SnapshotObserver.java:
##########
@@ -441,21 +443,33 @@ private long getMaxCountForSnapshotType(
     }
 
     private void observeLatestCheckpoint(FlinkResourceContext<CR> ctx, String 
jobId) {
-
         var status = ctx.getResource().getStatus();
         var jobStatus = status.getJobStatus();
 
-        ctx.getFlinkService()
-                .getLastCheckpoint(JobID.fromHexString(jobId), 
ctx.getObserveConfig())
-                .ifPresentOrElse(
-                        snapshot -> 
jobStatus.setUpgradeSavepointPath(snapshot.getLocation()),
-                        () -> {
-                            if (ReconciliationUtils.isJobCancelled(status)) {
-                                // For cancelled jobs the observed savepoint 
is always definite,
-                                // so if empty we know the job doesn't have any
-                                // checkpoints/savepoints
-                                jobStatus.setUpgradeSavepointPath(null);
-                            }
-                        });
+        try {
+            ctx.getFlinkService()
+                    .getLastCheckpoint(JobID.fromHexString(jobId), 
ctx.getObserveConfig())
+                    .ifPresentOrElse(
+                            snapshot -> 
jobStatus.setUpgradeSavepointPath(snapshot.getLocation()),
+                            () -> {
+                                if 
(ReconciliationUtils.isJobCancelled(status)) {
+                                    // For cancelled jobs the observed 
savepoint is always definite,
+                                    // so if empty we know the job doesn't 
have any
+                                    // checkpoints/savepoints
+                                    jobStatus.setUpgradeSavepointPath(null);
+                                }
+                            });
+        } catch (Exception e) {
+            if (ExceptionUtils.findThrowable(e, RestClientException.class)
+                    .map(ex -> ex.getMessage().contains("Checkpointing has not 
been enabled"))
+                    .orElse(false)) {
+                LOG.warn(
+                        "Checkpointing not enabled for job {}, skipping 
checkpoint observation",
+                        jobId,
+                        e);

Review Comment:
   Yeah, I thought about that. I'm open to either. We would just have 
`getLastCheckpoint` catch the exception and return `optional.empty()`



-- 
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]

Reply via email to