You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/11/16 07:59:16 UTC

[GitHub] [flink-kubernetes-operator] gaborgsomogyi commented on a diff in pull request #437: [FLINK-29609] Shut down JM for terminated applications after configured duration

gaborgsomogyi commented on code in PR #437:
URL: https://github.com/apache/flink-kubernetes-operator/pull/437#discussion_r1023637452


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -318,6 +319,31 @@ private boolean shouldRestartJobBecauseUnhealthy(
         return restartNeeded;
     }
 
+    private boolean cleanupTerminalJmAfterTtl(
+            FlinkDeployment deployment, Configuration observeConfig) {
+        var status = deployment.getStatus();
+        boolean terminal = ReconciliationUtils.isJobInTerminalState(status);
+        boolean jmStillRunning =
+                status.getJobManagerDeploymentStatus() != JobManagerDeploymentStatus.MISSING;
+
+        if (terminal && jmStillRunning) {
+            var ttl = observeConfig.get(KubernetesOperatorConfigOptions.OPERATOR_JM_SHUTDOWN_TTL);
+            boolean ttlPassed =
+                    Instant.now()

Review Comment:
   I know that the window in the test is big enough but using `now` in tests may make it flaky. I would add `Clock` param either to the function or as member var. In tests it can be `Clock.fixed...` and in PROD code `Clock.systemDefaultZone()`.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org