tillrohrmann commented on a change in pull request #8539: [FLINK-12617] 
[container] StandaloneJobClusterEntrypoint defaults to random JobID for non-HA 
setups
URL: https://github.com/apache/flink/pull/8539#discussion_r290265266
 
 

 ##########
 File path: 
flink-container/src/main/java/org/apache/flink/container/entrypoint/StandaloneJobClusterEntryPoint.java
 ##########
 @@ -97,14 +100,27 @@ public static void main(String[] args) {
 
                StandaloneJobClusterEntryPoint entrypoint = new 
StandaloneJobClusterEntryPoint(
                        configuration,
-                       clusterConfiguration.getJobId(),
+                       createJobIdForCluster(clusterConfiguration.getJobId(), 
configuration),
                        clusterConfiguration.getSavepointRestoreSettings(),
                        clusterConfiguration.getArgs(),
                        clusterConfiguration.getJobClassName());
 
                ClusterEntrypoint.runClusterEntrypoint(entrypoint);
        }
 
+       @VisibleForTesting
+       static JobID createJobIdForCluster(Optional<JobID> jobID, Configuration 
globalConfiguration) {
+               if (jobID.isPresent()) {
+                       return jobID.get();
+               }
+
+               if 
(!HighAvailabilityMode.isHighAvailabilityModeActivated(globalConfiguration)) {
+                       return JobID.generate();
+               } else {
+                       return ZERO_JOB_ID;
+               }
 
 Review comment:
   ```
   return jobID.orElseGet(
                        () -> {
                                if 
(HighAvailabilityMode.isHighAvailabilityModeActivated(globalConfiguration)) {
                                        return ZERO_JOB_ID;
                                } else {
                                        return JobID.generate();
                                }
                        });
   ```
   
   Seems a bit more idiomatic.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to